var curField = null;
var relationHT = new Array();
var relationQs = new Object();
var relationGroup = new Array();
var relationGroupHT = new Object();
var relationNotDisplayQ = new Object();
function setCookie(b, d, a, f, c, e) {
    document.cookie = b + "=" + escape(d) + ((a) ? "; expires=" + a : "") + ((f) ? "; path=" + f : "") + ((c) ? "; domain=" + c : "") + ((e) ? "; secure" : "");
}
var spChars = ["$", "}", "^", "|", "!", "<"];
var spToChars = ["ξ", "｝", "ˆ", "¦", "！", "&lt;"];
var prevInputControl = null;
var isLoadingAnswer = false;
var lastCostTime = 0;
var hasClickQ = false;
var needGoOut = false;
var hasShowTip = false;
var jpkeyword = "";
var enkeyword = "";
var enhighkeyword = "";
var enmiddlexiaokeyword = "";
var enmiddlekeyword = "";
var enxiaokeyword = "";
var enyouerkeyword = "";
var enforeinkeyword = "";
var enninekeyword = "";
var entenkeyword = "";
var en11keyword = "";
var en12keyword = "";
var jpmatch = 0;
function replace_specialChar(c) {
    for (var a = 0; a < spChars.length; a++) {
        var b = new RegExp("(\\" + spChars[a] + ")", "g");
        c = c.replace(b, spToChars[a]);
    }
    if (/^[A-Za-z\s\.,]+$/.test(c)) {
        c = c.replace(/\s+/g, " ");
    }
    c = c.replace(/[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]/ig, "");
    return $.trim(c);
}
function pushHistory() {
    if (window.__wxjs_environment === "miniprogram") {
        return;
    }
    var a = {title: "title", url: "#"};
    window.history.pushState(a, "title", "#");
    if (window.needHideShare == 1 || window.hideFriend == 1) {
        if (window.wx) {
            wx.hideMenuItems({menuList: menus});
        }
    }
}
function clickJp() {
    if (window._czc) {
        _czc.push(["_trackEvent", "未完成填写", "点击"]);
    }
    alert("提示：此活动仅限新用户领取，请按页面提示进行操作！");
    return true;
}
function show_zhezhao_tip(g) {
    if (g) {
        if ($("#zhezhaotip")[0]) {
            return;
        }
        var e = "";
        var b = window.notFinishTip.split(";");
        if (b.length == 2 && b[0].indexOf("http") == 0) {
            e = "<div style='width: 100%;height:80px; background-color: #e9f7ff; float: left;'><div style='float:left;margin-left:110px;font-size:14px; color: #6a696b; margin-top: 17px; line-height: 1.5;'>先领取<a onclick='return clickJp();' href='" + b[0] + "' style='text-decoration: underline; font-weight: bold;'>" + b[1] + "</a><br/>注满能量，再来填写吧！</div></div>";
        }
        var h = "<div style='width:100%; height:100px; background-color: #ffffff;float: left;'><div style='float: right; height: 100%; padding:15px;'><h1 style='font-size: 16px; color: #840615; line-height: 2.5;'>亲，你的意见很重要哦！</h1><div style='padding: 0 10px; background-color: #2c87f7; font-size: 16px; color: #fff; line-height: 2; float: left; border-radius: 6px;' onclick='show_zhezhao_tip(false);'>继续填写</div><div style='padding: 0 10px; background-color: #ababab; font-size: 16px; color: #fff; line-height: 2; float: left; border-radius: 6px; margin-left: 30px;' onclick='closeTipWindow(true);'>放弃</div></div></div>";
        var a = "<div class='popuptip' style='width:300px;background:#fff;border-radius: 4px;margin: auto;position: absolute; z-index: 9999;overflow: hidden;height:180px;'>" + h + e + "<img src='/images/wjx/smile.png' alt='' width='80' style='position: absolute; top:20px; left:10px;'>";
        "</div>";
        $("body").append('<div style="z-index:999;top: 0px;left: 0px;position: fixed;width: 100%;height: 100%;" id="zhezhaotip"><div style="position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;opacity: 0.5;background-color: #000;"></div>' + a + "</div>");
        var f = $("html").height();
        var c = $(window).height();
        var d = 100;
        c > f ? d = c : d = f;
        $("#zhezhaotip").height(d);
        $(".popuptip").css("left", ($(window).width() - $(".popuptip").width()) / 2);
        $(".popuptip").css("top", ($(window).height() - $(".popuptip").height()) / 2);
        if (!hasShowTip) {
            if (window._czc) {
                _czc.push(["_trackEvent", "未完成填写", "加载"]);
            }
        }
        setLastPop();
        hasShowTip = true;
    } else {
        $("#zhezhaotip").remove();
    }
}
function closeTipWindow(b) {
    var a = "确认不再填写问卷吗？";
    if (langVer == 1) {
        a = "Would you like to leave?";
    }
    if (window.WeixinJSBridge) {
        if (b || confirm(a)) {
            WeixinJSBridge.call("closeWindow");
        }
    } else {
        needGoOut = true;
        show_zhezhao_tip(false);
        if (window.close) {
            window.close();
        }
        window.history.back();
    }
}
function setLastPop() {
    if (!window.localStorage) {
        return;
    }
    localStorage.setItem("wjxlastpoptime", new Date().getTime());
}
function checkCanPop() {
    if (!window.localStorage) {
        return true;
    }
    if (localStorage.wjxuserpub) {
        return false;
    }
    if (window.location.href.indexOf("?pvw=1") > -1 || window.location.href.indexOf("&pvw=1") > -1) {
        return false;
    }
    if (window.isVip) {
        return false;
    }
    if (langVer == 1) {
        return false;
    }
    if (!window.notFinishTip) {
        return false;
    }
    var b = localStorage.wjxlastpoptime;
    if (!b) {
        return true;
    }
    var a = new Date().getTime();
    var c = (a - b) / (24 * 60 * 60 * 1000);
    if (c > 7) {
        return true;
    }
    return false;
}
$(function () {
    if (!$.support.leadingWhitespace) {
        window.location.href = window.location.href.replace("/m/", "/jq/");
    }
    if (!window.addEventListener) {
        return;
    }
    window.addEventListener("popstate", function (a) {
        if (!hasClickQ) {
            return;
        }
        if (needGoOut) {
            window.history.back();
            return;
        }
        pushHistory();
        var b = checkCanPop();
        if (window.notFinishTip && b) {
            show_zhezhao_tip(true);
        } else {
            closeTipWindow();
        }
    }, false);
});
String.prototype.format = function () {
    var a = arguments;
    return this.replace(/\{(\d+)\}/g, function (b, c) {
        return a[c];
    });
};
var curfilediv = null;
var isUploadingFile = false;
var cur_page = 0;
var hasSkipPage = false;
var prevControl = null;
var pageHolder = null;
var curMatrixFill = null;
var curMatrixError = null;
var imgVerify = null;
var questionsObject = new Object();
var allQArray = null;
var shopArray = new Array();
function setMatrixFill() {
    if (curMatrixError && !curMatrixFill.fillvalue) {
        return;
    }
    $("#divMatrixRel").hide();
}
function setChoice(b) {
    $(b.parentNode).find("span").html(b.options[b.selectedIndex].text);
    var a = $(b.parentNode).prev("input");
    a.val(b.value);
    a.trigger("change");
}
function showMatrixHeader(h, k) {
    if ($(k).attr("type") != "6" && $(k).attr("type") != "5") {
        return;
    }
    var e = $(h).offset();
    var l = e.top - 9;
    var c = e.left;
    var i = "选项";
    var r = $(h).width();
    if ($(k).attr("type") == "6") {
        if ($(h).attr("mode") == "6") {
            return;
        }
        l = e.top - 9;
        var o = $(window).width();
        var a = $(h).parent().parent();
        var g = $("td", a).index($(h).parent());
        var n = $("table.matrix-rating", k)[0];
        var b = n.rows[0].cells[g];
        var j = $(b).text();
        var q = j.length * 12;
        var d = (q - $(h).width()) / 2;
        c = e.left + r / 2;
    } else {
        if ($(h).attr("mode") && ($(h).attr("mode") == "2" || $(h).attr("mode") == "3" || $(h).attr("mode") == "4")) {
            var o = $(window).width();
            var e = $(h).offset();
            l = e.top - 9;
            var j = $(h).attr("title");
            var q = j.length * 12;
            c = e.left + r / 2;
        } else {
            if ($(h).attr("mode") && $(h).attr("mode") == "6") {
                var o = $(window).width();
                var e = $(h).offset();
                l = e.top - 9;
                var j = $(h).attr("title");
                var q = j.length * 12;
                c = e.left + r / 2;
            } else {
                var p = $(h).height();
                if (p == 19) {
                    p = 24;
                }
                l = e.top - 9;
                var j = $(h).attr("title");
                var q = j.length * 12;
                c = e.left + r / 2;
            }
        }
    }
    $("#divMatrixHeader").html(j);
    var m = $("#divMatrixHeader").outerHeight();
    var f = $("#divMatrixHeader").outerWidth();
    l -= m;
    c -= f / 2;
    $("#divMatrixHeader").css("top", l + "px").css("left", c + "px").show();
}
function showMatrixFill(f, c) {
    if (c) {
        if (curMatrixError) {
            return;
        }
        curMatrixError = f;
    }
    curMatrixFill = f;
    var e = f.fillvalue || "";
    $("#matrixinput").val(e);
    var b = $(f).attr("req");
    var a = "请注明...";
    var b = f.getAttribute("req");
    if (b) {
        a = "请注明...[必填]";
    }
    if (langVer == 1) {
        a = "Please specify";
    }
    matrixinput.setAttribute("placeholder", a);
    var g = $(f).offset();
    var d = g.top - $(f).height() + 45;
    $("#divMatrixRel").css("top", d + "px").css("left", "0").show();
}
function refresh_validate() {
    if (imgCode && tCode.style.display != "none" && imgCode.style.display != "none") {
        imgCode.src = "/wjx/join/AntiSpamImageGen.aspx?q=" + activityId + "&t=" + (new Date()).valueOf();
    }
    if (submit_text) {
        submit_text.value = "";
    }
    if (imgVerify) {
        imgVerify.onclick();
    }
    if (window.useAliVerify) {
        isCaptchaValid = false;
        if (captchaOjb) {
            captchaOjb.reload();
        }
    }
}
function processRadioInput(a, b) {
    if (a.prevRadio && a.prevRadio.itemText && a.prevRadio != b) {
        a.prevRadio.itemText.pvalue = a.prevRadio.itemText.value;
        a.prevRadio.itemText.value = "";
    }
    if (b.itemText && b != a.prevRadio) {
        b.itemText.value = b.itemText.pvalue || "";
    }
    a.prevRadio = b;
}
function addClearHref(b) {
    if (window.isKaoShi) {
        return;
    }
    if (b.hasClearHref) {
        b.clearHref.style.display = "";
        return;
    }
    var a = document.createElement("a");
    a.title = validate_info_submit_title2;
    a.style.color = "#999999";
    a.style.marginLeft = "25px";
    a.innerHTML = "[" + type_radio_clear + "]";
    a.href = "javascript:void(0);";
    b.hasClearHref = true;
    $(".field-label", b).append(a);
    b.clearHref = a;
    a.onclick = function () {
        clearFieldValue(b);
        referTitle(b);
        this.style.display = "none";
        jumpAny(false, b);
        saveAnswer(b);
    };
}
function referTitle(e, f) {
    if (!e[0]._titleTopic) {
        return;
    }
    var b = "";
    if (f == undefined) {
        $("input:checked", e).each(function (h) {
            var g = $(this).parent().next().html();
            if (b) {
                b += "&nbsp;";
            }
            b += g;
        });
    } else {
        b = f;
    }
    for (var c = 0; c < e[0]._titleTopic.length; c++) {
        var a = e[0]._titleTopic[c];
        var d = document.getElementById("spanTitleTopic" + a);
        if (d) {
            d.innerHTML = b;
        }
    }
}
var hasPeiEFull = false;
function emptyTitle() {
    if (needTip()) {
        return;
    }
    if (isWeiXin || window.top != window) {
        $("title").text("");
    }
}
function checkPeiE(b, d) {
    if (hasPeiEFull) {
        return;
    }
    if (d && b.attr("req") == "1" && b.attr("peie") == "1" && b[0].style.display == "") {
        var a = true;
        $(d, b).each(function () {
            var f = this.disabled;
            if (!f) {
                a = false;
                return false;
            }
        });
        if (a) {
            hasPeiEFull = true;
        }
    }
    var e = 0;
    if (b.attr("qingjing") == "1" && b[0].style.display == "") {
        if (b.attr("full") == "1") {
            hasPeiEFull = true;
            e = 1;
        }
    }
    if (hasPeiEFull) {
        var c = "此问卷配额已满，暂时不能填写！";
        if (e) {
            c = "此问卷情景题配额已满，不能填写。";
        }
        $(divTip).html(c).show();
    }
}
$(function () {
    if ($("#htitle").height() > 40) {
        $("#htitle").css("font-size", "20px");
    }
    var u = document.title;
    $(window).scroll(function (q) {
        var k = $("#toptitle").offset().top + 48;
        var i = $(this).scrollTop();
        if (i > k) {
            $("title").text(u);
        } else {
            emptyTitle();
        }
    });
    emptyTitle();
    pageHolder = $("fieldset.fieldset");
    for (var B = 0; B < pageHolder.length; B++) {
        var H = $(pageHolder[B]).attr("skip") == "true";
        if (H) {
            pageHolder[B].skipPage = true;
            hasSkipPage = true;
        }
        var a = $(".field", pageHolder[B]);
        pageHolder[B].questions = a;
        var x = 0;
        for (var C = 0; C < a.length; C++) {
            a[C].indexInPage = x;
            a[C].pageIndex = B;
            if (hasSkipPage) {
                a[C].pageParent = pageHolder[B];
            }
            x++;
        }
    }
    $("#divMatrixRel").bind("click", function (i) {
        i.stopPropagation();
    });
    $(document).bind("click", function () {
        setMatrixFill();
        postHeight();
    });
    $("#matrixinput").on("keyup blur focus", function () {
        if (curMatrixFill) {
            var q = $("#matrixinput").val();
            curMatrixFill.fillvalue = q;
            if (window.needSaveJoin) {
                var i = $(curMatrixFill).parents(".field");
                var k = i.attr("ischeck");
                saveMatrixFill(curMatrixFill, k);
                saveAnswer(i);
            }
        }
    });
    jpkeyword = (window.jpkeylist || "").split(/[,，]/);
    enkeyword = (window.enkeylist || "").split(/[,，]/);
    enhighkeyword = (window.enhighkeylist || "").split(/[,，]/);
    enmiddlekeyword = (window.enmiddlekeylist || "").split(/[,，]/);
    enmiddlexiaokeyword = (window.enmiddlexiaokeylist || "").split(/[,，]/);
    enxiaokeyword = (window.enxiaokeylist || "").split(/[,，]/);
    enyouerkeyword = (window.enyouerkeylist || "").split(/[,，]/);
    enforeinkeyword = (window.enforeinkeylist || "").split(/[,，]/);
    if (window.enninekeylist) {
        enninekeyword = (window.enninekeylist || "").split(/[,，]/);
    }
    if (window.entenkeylist) {
        entenkeyword = (window.entenkeylist || "").split(/[,，]/);
    }
    if (window.en11keylist) {
        en11keyword = (window.en11keylist || "").split(/[,，]/);
    }
    if (window.en12keylist) {
        en12keyword = (window.en12keylist || "").split(/[,，]/);
    }
    checkTitleDescMatch();
    var b = false;
    var G = new Array();
    allQArray = $(".field");
    allQArray.each(function () {
        var V = $(this);
        var q = V.attr("type");
        V.bind("click", function () {
            if (this.removeError) {
                this.removeError();
            }
            if (!hasClickQ) {
                pushHistory();
            }
            hasClickQ = true;
            try {
                checkJpMatch(q, this);
            } catch (k) {
            }
            if (window.loadGeetest) {
                window.loadGeetest();
            }
            if (window.scrollup) {
                scrollup.Stop();
            }
        });
        var ac = getTopic(V);
        questionsObject[ac] = V;
        var af = V.attr("isshop");
        if (af) {
            shopArray.push(this);
        }
        var Q = V.attr("relation");
        var S = "";
        if (Q && Q != "0") {
            if (Q.indexOf("|") != -1) {
                S = "|";
            } else {
                S = "$";
            }
            if (Q.indexOf(S) != -1) {
                var O = Q.split(S);
                for (var ad in O) {
                    var M = O[ad];
                    if (!M || M.indexOf(",") == -1) {
                        continue;
                    }
                    var L = M.split(",");
                    var ai = L[0];
                    var Y = L[1].split(";");
                    for (var T = 0; T < Y.length; T++) {
                        var N = ai + "," + Y[T];
                        if (!relationGroupHT[N]) {
                            relationGroupHT[N] = new Array();
                        }
                        relationGroupHT[N].push(this);
                    }
                    if (!relationQs[ai]) {
                        relationQs[ai] = new Array();
                    }
                    relationQs[ai].push(this);
                    relationGroup.push(ai);
                }
            } else {
                var L = Q.split(",");
                var ai = L[0];
                var Y = L[1].split(";");
                for (var T = 0; T < Y.length; T++) {
                    var N = ai + "," + Y[T];
                    if (!relationHT[N]) {
                        relationHT[N] = new Array();
                    }
                    relationHT[N].push(this);
                }
                if (!relationQs[ai]) {
                    relationQs[ai] = new Array();
                }
                relationQs[ai].push(this);
            }
            relationNotDisplayQ[ac] = "1";
        } else {
            if (Q == "0") {
                relationNotDisplayQ[ac] = "1";
            }
        }
        var W = V.attr("titletopic");
        if (W) {
            var ag = questionsObject[W];
            if (ag) {
                if (!ag[0]._titleTopic) {
                    ag[0]._titleTopic = new Array();
                }
                ag[0]._titleTopic.push(ac);
                var U = V.find(".field-label")[0];
                if (U) {
                    U.innerHTML = U.innerHTML.replace("[q" + W + "]", "<span id='spanTitleTopic" + ac + "' style='text-decoration:underline;'></span>");
                }
            }
        }
        if (V.attr("hrq") == "1") {
            return true;
        }
        if (q == "1") {
            var Z = $("input", V);
            if (Z[1]) {
                Z[0].confirmPwd = Z[1];
                Z[1].firstPwd = Z[0];
                $(Z[1]).on("keyup", function () {
                    this.firstPwd.needCheckConfirm = true;
                    verifyTxt(V, $(this));
                });
                Z = $(Z[0]);
            }
            Z.on("keyup blur click", function () {
                verifyTxt(V, Z);
                prevInputControl = this;
                window.hasAnswer = true;
                jump(V, this);
                referTitle(V, this.value);
                saveAnswer(V);
            });
            if (window.needSaveJoin) {
                Z.change(function () {
                    saveAnswer(V);
                });
            }
            Z.blur(function () {
                checkOnly(V, Z);
                if (lastFixedObj) {
                    $(lastFixedObj).addClass("fixed-style");
                }
            });
            Z.focus(function () {
                if (lastFixedObj) {
                    $(lastFixedObj).removeClass("fixed-style");
                }
            });
            var X = $("textarea", V);
            if (X[0]) {
                var i = X.prev("a")[0];
                i.par = V[0];
                X[0].par = V[0];
                V[0].needsms = true;
                var ah = X.parent().parent().find(".errorMessage")[0];
                V[0].mobileinput = Z[0];
                V[0].verifycodeinput = X[0];
                i.onclick = function () {
                    if (this.disabled) {
                        return;
                    }
                    var ak = this.par;
                    ak.mobileinput.value = $.trim(ak.mobileinput.value);
                    if (!/^\d{11}$/.test(ak.mobileinput.value)) {
                        alert("请输入正确的手机号码");
                        return;
                    }
                    if (ak.issmsvalid && ak.mobile == ak.mobileinput.value) {
                        return;
                    }
                    if (this.isSending) {
                        return;
                    }
                    if (!X[1]) {
                        return;
                    }
                    if (this.repeat && !confirm("您输入的手机号码“" + ak.mobileinput.value + "”确认准确无误吗？")) {
                        return;
                    }
                    if (this.getAttribute("nocode") == "1") {
                        i.sendActivitySms("0000");
                        return;
                    }
                    var al = "divVCode" + ac;
                    openDialogByIframe(300, 70, al);
                    var k = document.getElementById("yz_popdivData");
                    var am = k.getElementsByTagName("textarea")[0];
                    var aj = k.getElementsByTagName("img")[0];
                    if (aj.style.display == "none") {
                        aj.onclick = function () {
                            this.src = "/wjx/join/AntiSpamImageGen.aspx?t=" + (new Date()).valueOf();
                        };
                        aj.style.display = "";
                        aj.onclick();
                    }
                    $(am).on("keyup blur", function () {
                        var an = /^[0-9a-zA-Z]{4}$/g;
                        if (an.test(this.value)) {
                            i.sendActivitySms(this.value);
                            this.value = "";
                            $("#yz_popTanChuClose").click();
                        }
                    });
                    am.focus();
                };
                i.sendActivitySms = function (al) {
                    this.isSending = true;
                    this.disabled = true;
                    var ak = this.par;
                    var aj = this;
                    var k = "/joinnew/AnswerSmsHandler.ashx?q=" + activityId + "&mob=" + escape(ak.mobileinput.value) + "&valcode=" + al + "&t=" + (new Date()).valueOf();
                    $.ajax({
                        type: "GET", url: k, async: false, success: function (am) {
                            var an = "";
                            if (am == "true") {
                                an = "成功发送。如未收到，请检查手机号是否正确！";
                                aj.repeat = 1;
                                aj.resent();
                                X[0].readOnly = false;
                            } else {
                                if (am == "fast") {
                                    an = "发送频率过快";
                                    aj.resent();
                                } else {
                                    if (am == "no") {
                                        an = "发布者短信数量不够";
                                    } else {
                                        if (am == "fail") {
                                            an = "短信发送失败，每天最多发送5次！";
                                        } else {
                                            if (am == "error") {
                                                an = "手机号码不正确";
                                            } else {
                                                if (am == "nopub") {
                                                    an = "问卷未运行，不能填写";
                                                } else {
                                                    an = am;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            if (an.indexOf("图形验证码") > -1) {
                                aj.disabled = false;
                            }
                            ah.innerHTML = an;
                            aj.isSending = false;
                        }
                    });
                };
                i.resent = function () {
                    var aj = this;
                    var k = 60;
                    var ak = setInterval(function () {
                        k--;
                        if (k < 57) {
                            aj.isSending = false;
                        }
                        if (k > 0) {
                            aj.innerHTML = "重发(" + k + "秒)";
                        } else {
                            aj.innerHTML = "发送验证码";
                            aj.disabled = false;
                            clearInterval(ak);
                        }
                    }, 1000);
                };
                X[0].onchange = X[0].onblur = function () {
                    var ak = $.trim(this.value);
                    if (ak.length != 6) {
                        ah.innerHTML = "提示：请输入6位数字！";
                        return;
                    }
                    if (!/^\d+$/.exec(ak)) {
                        ah.innerHTML = "提示：请输入6位数字！";
                        return;
                    }
                    var aj = this.par;
                    if (aj.issmsvalid && aj.mobile == aj.mobileinput.value) {
                        return;
                    }
                    if (aj.prevcode == ak) {
                        return;
                    }
                    aj.prevcode = ak;
                    var k = "/joinnew/AnswerSmsValidateHandler.ashx?q=" + activityId + "&mob=" + escape(aj.mobileinput.value) + "&code=" + escape(ak) + "&t=" + (new Date()).valueOf();
                    $.ajax({
                        type: "GET", url: k, async: false, success: function (al) {
                            aj.issmsvalid = false;
                            var am = "";
                            if (al == "true") {
                                aj.issmsvalid = true;
                                aj.mobile = aj.mobileinput.value;
                                am = "成功通过验证";
                                writeError(aj, "", 1000);
                            } else {
                                if (al == "send") {
                                    am = "请先发送验证码，每天最多发送5次！";
                                } else {
                                    if (al == "no") {
                                        am = "验证码输入错误超过5次，无法再提交";
                                    } else {
                                        if (al == "error") {
                                            am = "验证码输入错误，连续输错5次将无法提交";
                                        }
                                    }
                                }
                            }
                            ah.innerHTML = am;
                        }
                    });
                };
            }
        } else {
            if (q == "2") {
                var Z = $("textarea", V);
                Z.on("keyup blur click", function () {
                    verifyTxt(V, Z);
                    prevInputControl = this;
                    window.hasAnswer = true;
                    jump(V, this);
                    referTitle(V, this.value);
                    saveAnswer(V);
                });
                Z.blur(function () {
                    checkOnly(V, Z);
                    if (lastFixedObj) {
                        $(lastFixedObj).addClass("fixed-style");
                    }
                });
                Z.focus(function () {
                    if (lastFixedObj) {
                        $(lastFixedObj).removeClass("fixed-style");
                    }
                });
            } else {
                if (q == "9") {
                    var aa = $("input", V);
                    aa.on("keyup blur change", function () {
                        var k = $(this);
                        prevInputControl = this;
                        msg = verifyTxt(V, $(this), true);
                        jump(V, this);
                        referTitle(V, this.value);
                        saveAnswer(V);
                    });
                    aa.blur(function () {
                        checkOnly(V, $(this));
                        if (lastFixedObj) {
                            $(lastFixedObj).addClass("fixed-style");
                        }
                    });
                    aa.focus(function () {
                        if (lastFixedObj) {
                            $(lastFixedObj).removeClass("fixed-style");
                        }
                    });
                } else {
                    if (q == "8") {
                        $("input", V).change(function () {
                            jump(V, this);
                            saveAnswer(V);
                        });
                    } else {
                        if (q == "12") {
                            $("input", V).change(function () {
                                var aj = null;
                                var am = $(V).attr("total");
                                var an = $("input:visible", V);
                                var ak = count = an.length;
                                var ao = am;
                                an.each(function (ap) {
                                    if (ap == ak - 1) {
                                        aj = this;
                                    }
                                    if ($(this).val()) {
                                        count--;
                                        ao = ao - $(this).val();
                                    }
                                });
                                if (count == 1 && aj && ao > 0) {
                                    $(aj).val(ao).change();
                                    ao = 0;
                                }
                                msg = "";
                                if (ao != 0 && count == 0) {
                                    var al = parseInt($(aj).val()) + ao;
                                    if (al >= 0) {
                                        if (aj != this) {
                                            $(aj).val(al).change();
                                            ao = 0;
                                        } else {
                                            if (an.length == 2) {
                                                var k = am - $(aj).val();
                                                $(an[0]).val(k).change();
                                                ao = 0;
                                            }
                                        }
                                    } else {
                                        msg = "，<span style='color:red;'>" + sum_warn + "</span>";
                                    }
                                }
                                if (ao == 0) {
                                    an.each(function (ap) {
                                        if (!$(this).val()) {
                                            $(this).val("0").change();
                                        }
                                    });
                                }
                                $(".relsum", V).html(sum_total + "<img src=\"/images/wjxmobile/prompt@2x.png\" alt=''><b>" + am + "</b>" + sum_left + "<span style='color:red;font-bold:true;'>" + (am - ao) + "</span>" + msg);
                                jump(V, this);
                                saveAnswer(V);
                            });
                        } else {
                            if (q == "13") {
                                b = true;
                            } else {
                                if (q == "3") {
                                    var R = $("div.ui-radio", V);
                                    R.each(function () {
                                        if (window.hasTouPiao) {
                                            var k = this.getAttribute("htp");
                                            if (k) {
                                                var aj = document.getElementById("spanPiao" + ac + "_" + k);
                                                if (aj && !aj.needHide) {
                                                    aj.style.display = "";
                                                }
                                            }
                                        }
                                    });
                                    checkPeiE(V, "input[type='radio']");
                                    R.bind("click", function (al) {
                                        var aj = $(this);
                                        if (V[0] && V[0].hasConfirm) {
                                            return;
                                        }
                                        var ak = aj.find("input[type='radio']")[0];
                                        if (ak.disabled) {
                                            return;
                                        }
                                        window.hasAnswer = true;
                                        $(V).find("div.ui-radio").each(function () {
                                            var am = $(this);
                                            am.find("input[type='radio']")[0].checked = false;
                                            am.find("a.jqradio").removeClass("jqchecked");
                                        });
                                        ak.checked = true;
                                        var k = aj.find("input.OtherRadioText")[0];
                                        if (k) {
                                            ak.itemText = k;
                                        }
                                        processRadioInput(V[0], ak);
                                        aj.find("a.jqradio").addClass("jqchecked");
                                        displayRelationByType(V, "input[type=radio]", 1);
                                        referTitle(V);
                                        jump(V, ak);
                                        if (V.attr("req") != "1") {
                                            addClearHref(V);
                                        }
                                        showAnswer(V, R, true);
                                        saveAnswer(V);
                                        if (aj.attr("desc") != 1) {
                                            al.preventDefault();
                                        }
                                    });
                                    var ae = V.attr("qingjing");
                                    if (ae) {
                                        G.push(V);
                                    }
                                    $("input.OtherRadioText", V).bind("click", function (am) {
                                        $(this.parentNode.parentNode.parentNode).find("div.ui-radio").each(function () {
                                            $(this).find("input[type='radio']")[0].checked = false;
                                            $(this).find("a.jqradio").removeClass("jqchecked");
                                        });
                                        prevInputControl = this;
                                        var k = $(this).attr("rel");
                                        var ak = $("#" + k)[0];
                                        ak.checked = true;
                                        var aj = $("#" + k).parent().parent();
                                        aj.find("a.jqradio").addClass("jqchecked");
                                        ak.itemText = this;
                                        var al = $(this).parents("div.field");
                                        processRadioInput(al[0], ak);
                                        displayRelationByType(al, "input[type=radio]", 1);
                                        jump(al, ak);
                                        saveAnswer(al);
                                        am.stopPropagation();
                                        am.preventDefault();
                                    });
                                    if (window.needSaveJoin) {
                                        $("input.OtherRadioText", V).bind("blur", function (k) {
                                            saveAnswer(V);
                                        });
                                    }
                                } else {
                                    if (q == "7") {
                                        var P = $("select", V);
                                        P.bind("change", function (aj) {
                                            $("span", this.parentNode).html(this.options[this.selectedIndex].text);
                                            displayRelationByType(V, "option", 5);
                                            jump(V, this.options[this.selectedIndex]);
                                            var k = this.options[this.selectedIndex].text;
                                            if (this.value == -2) {
                                                k = "";
                                            }
                                            referTitle(V, k);
                                            saveAnswer(V);
                                            aj.preventDefault();
                                        });
                                        if (P[0].selectedIndex > 0) {
                                            $("span", P[0].parentNode).html(P[0].options[P[0].selectedIndex].text);
                                        }
                                    } else {
                                        if (q == "10") {
                                            var ab = V.attr("select") == "1";
                                            if (ab) {
                                                $("select", V).bind("change", function () {
                                                    $("span", this.parentNode).html(this.options[this.selectedIndex].text);
                                                    jump(V, this);
                                                    saveAnswer(V);
                                                });
                                            }
                                            $("input", V).bind("focus", function () {
                                                if (lastFixedObj) {
                                                    $(lastFixedObj).removeClass("fixed-style");
                                                }
                                            }).bind("change blur", function () {
                                                var an = $(this);
                                                var am = an.val();
                                                prevInputControl = this;
                                                var aj = an.attr("isdigit");
                                                var al = aj == "1" || aj == "2";
                                                if (al) {
                                                    if (aj == "1" && parseInt(am) != am) {
                                                        an.val("");
                                                    } else {
                                                        if (aj == "2" && parseFloat(am) != am) {
                                                            an.val("");
                                                        } else {
                                                            var ak = an.attr("min");
                                                            if (ak && am - ak < 0) {
                                                                an.val("");
                                                            }
                                                            var k = an.attr("max");
                                                            if (k && am - k > 0) {
                                                                an.val("");
                                                            }
                                                        }
                                                    }
                                                } else {
                                                    msg = verifyTxt(V, $(this), true);
                                                }
                                                jump(V, this);
                                                saveAnswer(V);
                                            });
                                        } else {
                                            if (q == "5") {
                                                initRate(V);
                                            } else {
                                                if (q == "6") {
                                                    initRate(V, true);
                                                    setTableWidth(V);
                                                } else {
                                                    if (q == "4") {
                                                        var K = $("div.ui-checkbox", V);
                                                        K.each(function () {
                                                            if (window.hasTouPiao) {
                                                                var k = this.getAttribute("htp");
                                                                if (k) {
                                                                    var aj = document.getElementById("spanPiao" + ac + "_" + k);
                                                                    if (aj) {
                                                                        aj.style.display = "";
                                                                    }
                                                                }
                                                            }
                                                        });
                                                        checkPeiE(V, "input[type='checkbox']");
                                                        K.bind("click", function (ak) {
                                                            var al = $(this);
                                                            if (V[0] && V[0].hasConfirm) {
                                                                return;
                                                            }
                                                            var aj = al.find("input[type='checkbox']")[0];
                                                            if (aj.disabled) {
                                                                return;
                                                            }
                                                            aj.checked = !aj.checked;
                                                            window.hasAnswer = true;
                                                            if (aj.checked) {
                                                                al.find("a.jqcheck").addClass("jqchecked");
                                                            } else {
                                                                al.find("a.jqcheck").removeClass("jqchecked");
                                                            }
                                                            checkHuChi(V, this);
                                                            displayRelationByType(V, "input[type='checkbox']", 2);
                                                            verifyCheckMinMax(V, false, false, this);
                                                            jump(V, aj);
                                                            if (window.createItem) {
                                                                createItem(V);
                                                            }
                                                            var k = al.find("input.OtherText")[0];
                                                            if (k) {
                                                                if (!aj.checked) {
                                                                    k.pvalue = k.value;
                                                                    k.value = "";
                                                                } else {
                                                                    k.value = k.pvalue || "";
                                                                }
                                                            }
                                                            referTitle(V);
                                                            showAnswer(V, K);
                                                            saveAnswer(V);
                                                            ak.preventDefault();
                                                        });
                                                        $("input.OtherText", V).bind("click", function (an) {
                                                            var aj = $(this).attr("rel");
                                                            var ak = $("#" + aj)[0];
                                                            prevInputControl = this;
                                                            var am = $(this).parents("div.field");
                                                            var k = am.attr("maxvalue");
                                                            if (k) {
                                                                var ao = $("input:checked", am).length;
                                                                if (ao > k || (ao == k && !ak.checked)) {
                                                                    $(this).blur();
                                                                    an.stopPropagation();
                                                                    an.preventDefault();
                                                                    return;
                                                                }
                                                            }
                                                            ak.checked = true;
                                                            ak.itemText = this;
                                                            var al = $("#" + aj).parents(".ui-checkbox");
                                                            al.find("a.jqcheck").addClass("jqchecked");
                                                            if (this.pvalue && !this.value) {
                                                                this.value = this.pvalue;
                                                            }
                                                            checkHuChi(am, al[0]);
                                                            displayRelationByType(am, "input[type=checkbox]", 2);
                                                            jump(am, ak);
                                                            verifyCheckMinMax(am, false);
                                                            if (window.createItem) {
                                                                createItem(am);
                                                            }
                                                            saveAnswer(am);
                                                            an.stopPropagation();
                                                            an.preventDefault();
                                                        });
                                                        if (window.needSaveJoin) {
                                                            $("input.OtherText", V).bind("blur", function (k) {
                                                                saveAnswer(V);
                                                            });
                                                        }
                                                    } else {
                                                        if (q == "21") {
                                                            $(".shop-item", V).each(function () {
                                                                var k = $(".itemnum", this);
                                                                var aj = $(".item_left", this);
                                                                $(".add", this).bind("click", function (al) {
                                                                    var ao = false;
                                                                    var ak = 0;
                                                                    if (aj[0]) {
                                                                        ao = true;
                                                                        ak = parseInt(aj.attr("num"));
                                                                    }
                                                                    var an = parseInt(k.val());
                                                                    if (ao && an >= ak) {
                                                                        var am = "库存只剩" + ak + "件，不能再增加！";
                                                                        if (ak <= 0) {
                                                                            am = "已售完，无法添加";
                                                                        }
                                                                        alert(am);
                                                                    } else {
                                                                        k.val(an + 1);
                                                                        updateCart(V);
                                                                    }
                                                                    al.preventDefault();
                                                                });
                                                                k.bind("focus", function (ak) {
                                                                    if (k.val() == "0") {
                                                                        k.val("");
                                                                    }
                                                                });
                                                                k.bind("blur change", function (am) {
                                                                    if (!k.val()) {
                                                                        k.val("0");
                                                                    }
                                                                    var ap = parseInt(k.val());
                                                                    if (!ap || ap < 0) {
                                                                        k.val("0");
                                                                        updateCart(V);
                                                                        return;
                                                                    }
                                                                    var ao = false;
                                                                    var al = 0;
                                                                    if (aj[0]) {
                                                                        ao = true;
                                                                        al = parseInt(aj.attr("num"));
                                                                    }
                                                                    if (ao) {
                                                                        if (ap > al) {
                                                                            var an = "库存只剩" + al + "件，不能超过库存！";
                                                                            if (al <= 0) {
                                                                                an = "已售完，无法添加";
                                                                            }
                                                                            alert(an);
                                                                            var ak = al;
                                                                            if (ak < 0) {
                                                                                ak = 0;
                                                                            }
                                                                            k.val(ak);
                                                                        }
                                                                    }
                                                                    updateCart(V);
                                                                    am.preventDefault();
                                                                });
                                                                $(".remove", this).bind("click", function (ak) {
                                                                    var al = parseInt(k.val());
                                                                    if (al > 0) {
                                                                        k.val(al - 1);
                                                                        updateCart(V);
                                                                    }
                                                                    ak.preventDefault();
                                                                });
                                                            });
                                                        } else {
                                                            if (q == "11") {
                                                                $("li.ui-li-static", V).bind("click", function (ak) {
                                                                    var k = $(this).find("input.OtherText")[0];
                                                                    if (!$(this).attr("check")) {
                                                                        var aj = $(this.parentNode).find("li[check='1']").length + 1;
                                                                        $(this).find("span.sortnum").html(aj).addClass("sortnum-sel");
                                                                        $(this).attr("check", "1");
                                                                        if (k && k.pvalue) {
                                                                            k.value = k.pvalue || "";
                                                                        }
                                                                    } else {
                                                                        var aj = $(this).find("span").html();
                                                                        $(this.parentNode).find("li[check='1']").each(function () {
                                                                            var al = $(this).find("span.sortnum").html();
                                                                            if (al - aj > 0) {
                                                                                $(this).find("span.sortnum").html(al - 1);
                                                                            }
                                                                        });
                                                                        $(this).find("span.sortnum").html("").removeClass("sortnum-sel");
                                                                        $(this).attr("check", "");
                                                                        if (k) {
                                                                            k.pvalue = k.value;
                                                                            k.value = "";
                                                                        }
                                                                    }
                                                                    displayRelationByType(V, "li.ui-li-static", 3);
                                                                    verifyCheckMinMax(V, false, true, this);
                                                                    jump(V, this);
                                                                    if (window.createItem) {
                                                                        createItem(V, true);
                                                                    }
                                                                    saveAnswer(V);
                                                                    ak.preventDefault();
                                                                });
                                                                $("input.OtherText", V).bind("click", function (am) {
                                                                    am.stopPropagation();
                                                                    am.preventDefault();
                                                                    var k = $(this).attr("rel");
                                                                    var ak = $("#" + k).eq(0).parent("li.ui-li-static");
                                                                    var aj = ak.eq(0).parent("ul.ui-controlgroup");
                                                                    if (ak.attr("check") != 1) {
                                                                        var al = aj.find("li[check='1']").length + 1;
                                                                        ak.find("span.sortnum").html(al).addClass("sortnum-sel");
                                                                        ak.attr("check", "1");
                                                                    }
                                                                    displayRelationByType(V, "li.ui-li-static", 3);
                                                                    verifyCheckMinMax(V, false, true, this);
                                                                    jump(V, this);
                                                                    if (window.createItem) {
                                                                        createItem(V, true);
                                                                    }
                                                                    saveAnswer(V);
                                                                    am.preventDefault();
                                                                });
                                                                if (window.needSaveJoin) {
                                                                    $("input.OtherText", V).bind("blur", function (k) {
                                                                        saveAnswer(V);
                                                                    });
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    });
    if (window.totalCut && window.totalCut > 0) {
        for (var C = 0; C < window.totalCut; C++) {
            var l = "divCut" + (C + 1);
            var I = $("#" + l);
            var m = I.attr("relation");
            var o = "";
            if (m && m != "0") {
                if (m.indexOf("|") != -1) {
                    o = "|";
                } else {
                    o = "$";
                }
                if (m.indexOf(o) != -1) {
                    var h = m.split(o);
                    for (var B in h) {
                        var f = h[B];
                        if (!f || f.indexOf(",") == -1) {
                            continue;
                        }
                        var e = f.split(",");
                        var J = e[0];
                        var v = e[1].split(";");
                        for (var p = 0; p < v.length; p++) {
                            var g = J + "," + v[p];
                            if (!relationGroupHT[g]) {
                                relationGroupHT[g] = new Array();
                            }
                            relationGroupHT[g].push(I[0]);
                        }
                        if (!relationQs[J]) {
                            relationQs[J] = new Array();
                        }
                        relationQs[J].push(I[0]);
                        relationGroup.push(J);
                    }
                } else {
                    var e = m.split(",");
                    var J = e[0];
                    var v = e[1].split(";");
                    relationNotDisplayQ[I.attr("topic")] = "1";
                    for (var p = 0; p < v.length; p++) {
                        var g = J + "," + v[p];
                        if (!relationHT[g]) {
                            relationHT[g] = new Array();
                        }
                        relationHT[g].push(I[0]);
                    }
                    if (!relationQs[J]) {
                        relationQs[J] = new Array();
                    }
                    relationQs[J].push(I[0]);
                }
            }
            var t = I.attr("titletopic");
            if (t) {
                var E = questionsObject[t];
                if (E) {
                    if (!E[0]._titleTopic) {
                        E[0]._titleTopic = new Array();
                    }
                    var A = I.attr("topic");
                    E[0]._titleTopic.push(A);
                    var r = I[0].childNodes[0];
                    if (r) {
                        r.innerHTML = r.innerHTML.replace("[q" + t + "]", "<span id='spanTitleTopic" + A + "' style='text-decoration:underline;'></span>");
                    }
                }
            }
        }
    }
    for (var z = 0; z < pageHolder.length; z++) {
        var a = pageHolder[z].questions;
        for (var C = 0; C < a.length; C++) {
            var A = getTopic(a[C]);
            if (relationQs[A]) {
                relationJoin(a[C]);
            }
            var D = $(a[C]).attr("refered");
            if (D && window.createItem) {
                createItem(a[C]);
            }
        }
    }
    for (var j = 0; j < G.length; j++) {
        var s = G[j];
        if (s[0].style.display == "") {
            displayRelationByType(s, "input[type=radio]", 1);
        }
    }
    for (var z = 0; z < pageHolder.length; z++) {
        var a = pageHolder[z].questions;
        for (var C = 0; C < a.length; C++) {
            checkPeiE($(a[C]));
        }
    }
    $("#ctlNext") != null && $("#ctlNext").on("click", function () {
        debugLog("准备提交答卷");
        if (this.disabled) {
            return;
        }
        if (needTip()) {
            alert($(divTip).text());
            return;
        }
        if (window.IsPar) {
            alert("此问卷为预览状态，不能提交");
            return;
        }
        $("#action").val("1");
        debugLog("验证提交数据");
        var i = validate($(this).parent());
        if (!i) {
            return;
        }
        $("html, body").animate({scrollTop: $(document).height()}, 600);
        debugLog("判断是否需要验证码");
        if (window.useAliVerify) {
            if (!isCaptchaValid) {
                $("#captcha").fadeIn("fast");
                return;
            }
        } else {
            if (tCode && tCode.style.display != "none" && (submit_text.value == "" || submit_text.value == validate_info_submit_title3)) {
                try {
                    submit_text.focus();
                    submit_text.click();
                } catch (k) {
                }
                alert(validate_info_submit1);
                return;
            }
        }
        debugLog("进入提交函数");
        groupAnswer(1);
    });
    setVerifyCode();
    initSlider();
    if (totalPage > 1) {
        $("#divSubmit").hide();
        $("#divNext")[0].style.display = "";
        showProgress();
    } else {
        $("#divSubmit").show();
    }
    if (window.hasPageTime) {
        if (!window.divFengMian) {
            processMinMax();
        }
    }
    if (window.isChuangGuan == 2) {
        $("#divSubmit").hide();
        if (!window.divFengMian) {
            startChuangGuan(false);
        }
    }
    fixBottom();
    $(window).load(function () {
        fixBottom();
    });
    if (window.cepingCandidate) {
        var w = cepingCandidate.split("&nbsp;&nbsp;&nbsp;");
        var y = new Object();
        for (var F = 0; F < w.length; F++) {
            var d = w[F].replace(/(\s*)/g, "").replace(/&/g, "").replace(/\\/g, "").replace("&nbsp;", "").toLowerCase();
            y[d] = "1";
        }
        var n = $("#div1");
        $("input[type=checkbox]", n).each(function () {
            var q = $(this).parent().parent();
            var k = q.find(".label")[0];
            if (!k) {
                return true;
            }
            var i = k.innerHTML;
            i = i.replace(/(\s*)/g, "").replace(/&amp;/g, "").replace(/\\/g, "").replace("&nbsp;", "").toLowerCase();
            if (y[i]) {
                this.checked = true;
            }
        });
        if (n[0]) {
            createItem(n, false);
            n[0].style.display = "none";
            n[0].isCepingQ = "1";
        }
    }
    processAward();
    checkAnswer();
    var c = document.getElementsByTagName("img");
    for (var C = 0; C < c.length; C++) {
        c[C].onerror = function () {
            this.onerror = null;
            replaceImg(this);
        };
        replaceImg(c[C]);
    }
    processSearch();
    if (pageHolder[0]) {
        adjustVideoHeight(pageHolder[0]);
    }
});
function adjustVideoHeight(e) {
    if (e.hasAdjust) {
        return;
    }
    e.hasAdjust = true;
    var c = e.getElementsByTagName("iframe");
    for (var b = 0; b < c.length; b++) {
        if (c[b].getAttribute("video") == "2") {
            c[b].style.width = "100%";
            var d = c[b].clientWidth;
            var a = parseInt(d) / 640 * parseInt(c[b].height) + 15;
            c[b].setAttribute("style", "height:" + parseInt(a) + "px !important");
        }
    }
}
function replaceImg(c) {
 /*   var b = "http://pubimage.sojump.cn";
    var a = "//pubalifr.sojump.cn";
    if (c.src.indexOf("http://pubssl.sojump.com") == 0 || c.src.indexOf("https://pubssl.sojump.com") == 0 || c.src.indexOf("http://pubimage.sojump.com") == 0) {
        c.src = c.src.replace("http://pubssl.sojump.com", b).replace("https://pubssl.sojump.com", b).replace("http://pubimage.sojump.com", b);
    } else {
        if (c.src.indexOf("http://pubalifr.sojump.com") == 0 || c.src.indexOf("https://pubalifr.sojump.com") == 0 || c.src.indexOf("https://pubali.sojump.com") == 0 || c.src.indexOf("http://pubali.sojump.com") == 0) {
            c.src = c.src.replace("http://pubalifr.sojump.com", a).replace("https://pubalifr.sojump.com", a).replace("http://pubali.sojump.com", a).replace("https://pubali.sojump.com", a);
        }
    }*/
}
var hasConfirmBtn = false;
function showAnswer(b, d) {
    if (!window.isChuangGuan) {
        return;
    }
    if (b.attr("ceshi") != "1") {
        return;
    }
    if (window.isChuangGuan == 2) {
        canNext(b, d);
        return;
    }
    var a = $(b)[0];
    if (a.confirmButton) {
        return;
    }
    var c = document.createElement("a");
    c.style.marginTop = "5px";
    c.className = "sumitbutton cancle";
    a.insertBefore(c, a.lastChild);
    a.confirmButton = c;
    c.innerHTML = "确认";
    c.onclick = function () {
        if (!hasConfirmBtn) {
            if (!confirm("确认后答案将无法修改，确认吗？")) {
                return;
            }
        }
        a.hasConfirm = true;
        hasConfirmBtn = true;
        var i = true;
        var h = "";
        d.each(function () {
            var j = this.getAttribute("ans") == "1";
            var k = $("input", this)[0];
            if (j) {
                if (!k.checked) {
                    i = false;
                }
                var l = $(".label", this).html();
                if (/^[A-Z][\.、．\s]/.test(l)) {
                    l = l.substring(0, 1);
                }
                if (h) {
                    h += ",";
                }
                h += l;
            } else {
                if (k.checked) {
                    i = false;
                }
            }
        });
        if (!a.correctAnswer) {
            var g = document.createElement("div");
            g.style.marginTop = "10px";
            a.insertBefore(g, a.lastChild);
            a.correctAnswer = g;
        }
        var e = i ? "<span style='color:green;'>回答正确</span>" : "<span style='color:red;'>回答错误，正确答案为：" + h + "</span>";
        a.correctAnswer.innerHTML = e;
        var f = document.getElementById("divjx" + a.id.replace("div", ""));
        if (f) {
            f.style.display = "";
        }
    };
}
function restoreAnswer() {
    if (!window.localStorage) {
        return null;
    }
    var c = localStorage.wjxtempanswerid;
    if (c != activityId) {
        return null;
    }
    if (window.randomMode) {
        return;
    }
    var a = "wjxtempanswer";
    var h = localStorage[a];
    if (!h) {
        return null;
    }
    var b = localStorage.wjxtempanswerdat;
    if (!b) {
        return null;
    }
    var j = window.qBeginDate || 0;
    if (b - j < 0) {
        return null;
    }
    var f = h.split(spChars[1]);
    var g = new Array();
    for (var e = 0; e < f.length; e++) {
        var d = f[e].split(spChars[0]);
        var k = new Object();
        k._value = d[1];
        k._topic = d[0];
        g.push(k);
    }
    return g;
}
function saveAnswer(d) {
    if (!window.localStorage) {
        return;
    }
    if (!window.needSaveJoin) {
        return;
    }
    if (window.randomMode) {
        return;
    }
    try {
        var b = "wjxtempanswer";
        var k = localStorage[b];
        var f = restoreAnswer();
        if (f == null) {
            f = new Array();
        }
        var e = getTopic(d);
        var m = new Object();
        var j = $(d).attr("type");
        m._topic = e;
        m._value = "";
        getAnswer(d, m, j, true);
        var h = false;
        for (var c = 0; c < f.length; c++) {
            if (f[c]._topic == m._topic) {
                h = true;
                f[c]._value = m._value;
                break;
            }
        }
        if (!h) {
            f.push(m);
        }
        f.sort(function (n, i) {
            return n._topic - i._topic;
        });
        var l = "";
        for (c = 0; c < f.length; c++) {
            if (c > 0) {
                l += spChars[1];
            }
            l += f[c]._topic;
            l += spChars[0];
            l += f[c]._value;
        }
        saveSubmitAnswer(l);
    } catch (g) {
    }
}
function saveSubmitAnswer(a) {
    if (!window.localStorage) {
        return;
    }
    localStorage.setItem("wjxtempanswer", a);
    localStorage.setItem("wjxtempanswerid", activityId);
    localStorage.setItem("wjxtempanswerdat", new Date().getTime());
    localStorage.setItem("wjxfirstloadtime", fisrtLoadTime);
    localStorage.setItem("wjxsavepage", cur_page);
}
function clearAnswer() {
    if (!window.localStorage) {
        return;
    }
    var a = localStorage.wjxtempanswerid;
    if (a != activityId) {
        return;
    }
    localStorage.removeItem("wjxtempanswer");
    localStorage.removeItem("wjxtempanswerid");
    localStorage.removeItem("wjxtempanswerdat");
    localStorage.removeItem("wjxfirstloadtime");
    localStorage.removeItem("wjxlastcosttime");
}
function loadAnswer() {
    var g = restoreAnswer();
    if (g == null) {
        return;
    }
    if (localStorage.wjxfirstloadtime) {
        lastCostTime = localStorage.wjxtempanswerdat - localStorage.wjxfirstloadtime;
        if (localStorage.wjxlastcosttime) {
            lastCostTime += parseInt(localStorage.wjxlastcosttime);
        }
        localStorage.setItem("wjxlastcosttime", lastCostTime);
    }
    isLoadingAnswer = true;
    var s = localStorage.wjxsavepage;
    for (var y = 0; y < g.length; y++) {
        var u = g[y]._topic;
        var D = g[y]._value;
        if (!D) {
            continue;
        }
        var r = $("#div" + u);
        if (r[0].style.display == "none") {
            continue;
        }
        cur_page = r[0].pageIndex || 0;
        var B = $(r).attr("type");
        switch (B) {
            case"1":
                var l = $("input", r);
                l.val(D).trigger("blur");
                if (l.parent().hasClass("getLocalBtn")) {
                    l.parent().prev().text(D).show();
                }
                break;
            case"2":
                $("textarea", r).val(D).trigger("blur");
                break;
            case"3":
                var x = D.split(spChars[2]);
                $("input", r).each(function () {
                    if (this.type == "radio" && this.value == x[0]) {
                        if (x[1]) {
                            var a = $(this).attr("rel");
                            if (a) {
                                $("#" + a).val(x[1]);
                            }
                        }
                        r[0].prevRadio = this;
                        $(this.parentNode.parentNode).trigger("click");
                    }
                });
                break;
            case"4":
                var v = D.split(spChars[3]);
                $("input", r).each(function () {
                    if (this.type != "checkbox") {
                        return true;
                    }
                    var F = this.value;
                    for (var j = 0; j < v.length; j++) {
                        var E = v[j].split(spChars[2]);
                        if (E[0] == F) {
                            if (E[1]) {
                                var a = $(this).attr("rel");
                                if (a) {
                                    $("#" + a).val(E[1])[0].pvalue = E[1];
                                }
                            }
                            $(this.parentNode.parentNode).trigger("click");
                            break;
                        }
                    }
                });
                break;
            case"5":
                $(".rate-off", r).each(function () {
                    if (this.getAttribute("val") == D) {
                        $(this).parent().trigger("click");
                    }
                });
                break;
            case"7":
                $("select", r).val(D).trigger("change");
                break;
            case"11":
                var v = D.split(",");
                $("input", r).each(function () {
                    if (this.type != "hidden") {
                        return true;
                    }
                    var F = this.value;
                    for (var j = 0; j < v.length; j++) {
                        var E = v[j].split(spChars[2]);
                        if (E[0] == F) {
                            if (E[1]) {
                                var a = $(this).attr("rel");
                                if (a) {
                                    $("#" + a).val(E[1])[0].pvalue = E[1];
                                }
                            }
                            $(this.parentNode).trigger("click");
                            break;
                        }
                    }
                });
                break;
            case"8":
                var z = $("input", r);
                z.val(D);
                var b = r.attr("hasjump");
                if (b) {
                    $(z).trigger("change");
                }
                break;
            case"21":
                var v = D.split(spChars[3]);
                var h = $("input", r);
                for (var w = 0; w < v.length; w++) {
                    var d = v[w].split(spChars[2]);
                    var t = parseInt(d[0]) - 1;
                    $(h[t]).val(d[1]);
                }
                updateCart(r);
                break;
            case"12":
            case"9":
                var e = D.split(spChars[2]);
                var k = new Object();
                for (var w = 0; w < e.length; w++) {
                    var m = e[w].split(spChars[4]);
                    if (m.length == 2) {
                        k[m[0]] = m[1];
                    }
                }
                var b = r.attr("hasjump");
                $("input", r).each(function (E) {
                    var a = $(this);
                    if (B == "12" && window.hasReferClient) {
                        var F = this.parentNode.parentNode.parentNode;
                        if (F && F.style.display == "none") {
                            return true;
                        }
                    }
                    var G = a.attr("rowid");
                    if (!G) {
                        a.val(e[E]);
                    } else {
                        var j = k[G];
                        a.val(j);
                    }
                    if (a.attr("verify") == "指定选项") {
                        if (a.val()) {
                            a.next().find("select").val(a.val()).trigger("change");
                        }
                    }
                    $(a).trigger("change");
                });
                break;
            case"13":
                r[0].fileName = D || "";
                if (D) {
                    $(".uploadmsg", r).html("文件已经成功上传！");
                }
                break;
            case"10":
                var e = D.split(spChars[2]);
                var k = new Object();
                for (var w = 0; w < e.length; w++) {
                    var m = e[w].split(spChars[4]);
                    if (m.length == 2) {
                        k[m[0]] = m[1];
                    }
                }
                var p = "input";
                var A = false;
                if (r.attr("select") == "1") {
                    p = "select";
                    A = true;
                }
                var b = r.attr("hasjump");
                $("table", r).each(function () {
                    var G = this;
                    if (window.hasReferClient) {
                        var F = G.parentNode;
                        if (F && F.style.display == "none") {
                            return true;
                        }
                    }
                    var E = G.parentNode.getAttribute("rowid");
                    var i = k[E];
                    var j = i.split(spChars[3]);
                    var a = 0;
                    $(p, this).each(function () {
                        this.value = j[a] || "";
                        if (A) {
                            $(this).trigger("change");
                        } else {
                            if (b) {
                                $(this).trigger("change");
                            }
                        }
                        a++;
                    });
                });
                break;
            case"6":
                var e = D.split(",");
                var k = new Object();
                for (var w = 0; w < e.length; w++) {
                    var m = e[w].split(spChars[4]);
                    if (m.length == 2) {
                        k[m[0]] = m[1];
                    }
                }
                var C = $(r).attr("ischeck");
                var n = $("table.matrix-rating", r);
                var q = n[0].rows;
                for (var w = 0; w < q.length; w++) {
                    var c = q[w];
                    var f = c.getAttribute("tp");
                    if (f != "d") {
                        continue;
                    }
                    if (window.hasReferClient && c.style.display == "none") {
                        continue;
                    }
                    var o = parseInt(c.getAttribute("rowindex")) + 1;
                    var m = e[o];
                    $(".rate-off", c).each(function () {
                        var E = $(this).attr("dval");
                        if (C) {
                            var F = k[o].split(";");
                            for (var j = 0; j < F.length; j++) {
                                var a = F[j].split(spChars[2]);
                                if (E == a[0]) {
                                    if (a[1]) {
                                        this.fillvalue = a[1];
                                    }
                                    $(this).trigger("click");
                                }
                            }
                        } else {
                            var F = k[o].split(spChars[2]);
                            if (E == F[0]) {
                                if (F[1]) {
                                    this.fillvalue = F[1];
                                }
                                $(this).trigger("click");
                            }
                        }
                    });
                }
                break;
        }
    }
    cur_page = 0;
    if (s && s >= cur_page + 1) {
        pageHolder[0].style.display = "none";
        cur_page = s - 1;
        localStorage.setItem("wjxsavepage", s);
        show_next_page();
    }
    isLoadingAnswer = false;
}
function needTip() {
    if (window.divTip && divTip.style.display == "") {
        if ($("img", divTip)[0]) {
            divTip.style.background = "none";
        }
        var a = $.trim($(divTip).text());
        if (a) {
            return true;
        }
    }
    return false;
}
function checkAnswer() {
    if (window.needSaveJoin) {
        loadAnswer();
    } else {
        if (window.localStorage && !needTip()) {
            var a = restoreAnswer();
            if (a) {
                $("#divLoadAnswer").show();
            }
        }
    }
}
function hideAward() {
    if (!confirm("确认不再领取吗？")) {
        return;
    }
    if (window.localStorage) {
        vkey = "award_" + activityId;
        localStorage.removeItem(vkey);
        localStorage.removeItem(vkey + "name");
        localStorage.removeItem(vkey + "tip");
    }
    $("#divContent").show().prev().hide();
    initSlider();
}
function processAward() {
    var b = "join_" + activityId;
    if (!document.cookie || document.cookie.indexOf(b + "=") == -1) {
        return;
    }
    b = "award_" + activityId;
    var d = "";
    var a = "";
    if (window.localStorage) {
        d = localStorage[b];
        a = localStorage[b + "name"];
    }
    if (d && d.indexOf("http") == 0) {
        var c = localStorage[b + "tip"];
        var f = "";
        if (c) {
            f = " onclick='alert(\"" + c + "\");return true;' ";
        }
        var e = "<div style='margin:10px 12px;'>恭喜您抽中了" + a + "，如已领取请忽略！<br/><div style='text-align:center;'><a href='" + d + "'" + f + " class='button white' target='_blank' style='color:#fff; background:#e87814;'>立即领取</a></div><div style='margin-top:18px;text-align:center;'><a href='javascript:' onclick='hideAward();' style='color:#666;font-size:14px;'>不领取，重新填写问卷</a></div></div>";
        $("#divContent").before(e);
        $("#divContent").hide();
    }
}
function postHeight() {
    if (window == window.top) {
        return;
    }
    try {
        var c = parent.postMessage ? parent : parent.document.postMessage ? parent.document : null;
        if (c != null) {
            var a = $("body").height();
            return c.postMessage("heightChanged," + a, "*");
        }
    } catch (b) {
    }
}
function saveMatrixFill(b, a) {
    if (!window.needSaveJoin) {
        return;
    }
    var c = b.parentNode.parentNode;
    var e = c.getAttribute("fid");
    if (!e) {
        return;
    }
    var d = "";
    if (a) {
        $(".rate-on", c).each(function () {
            if (d) {
                d += ";";
            }
            d += $(this).attr("dval");
            if (this.fillvalue) {
                var g = replace_specialChar(this.fillvalue).replace(/;/g, "；").replace(/,/g, "，");
                d += spChars[2] + g;
            }
        });
    } else {
        d = $(b).attr("dval");
        if (b.fillvalue) {
            var f = replace_specialChar(b.fillvalue).replace(/;/g, "；").replace(/,/g, "，");
            d += spChars[2] + f;
        }
    }
    $("#" + e).val(d);
}
function saveLikert(a) {
    var b = $("a.rate-on", a);
    if (b.length == 0) {
        $("input:hidden", a).val("");
    } else {
        $("input:hidden", a).attr("value", $(b[b.length - 1]).attr("val"));
    }
}
function setTableWidth(a) {
}
function initRate(a, b) {
    $(".rate-off", a).parent().bind("click", function (k) {
        var c = $(a).attr("ischeck");
        var f = $("a", this)[0];
        if (c) {
            var h = true;
            var n = $(a).attr("maxvalue");
            if (n && !$(f).hasClass("rate-on")) {
                var m = $("a.rate-on", this.parentNode);
                if (n - m.length <= 0) {
                    h = false;
                }
            }
            if (h) {
                $(f).toggleClass("rate-on");
                $(f).toggleClass("rate-onchk");
                $(f).trigger("change");
            }
        } else {
            if (CheckMax(f, b)) {
                var g = $(this.parentNode).find("a.rate-off");
                g.removeClass("rate-on");
                var j = $(f).attr("mode");
                if (j) {
                    g.removeClass("rate-on" + j);
                    var l = f;
                    g.each(function () {
                        $(this).toggleClass("rate-on");
                        $(this).toggleClass("rate-on" + j);
                        if (this == l) {
                            return false;
                        }
                    });
                } else {
                    $(f).toggleClass("rate-on");
                    if (!$(f).text()) {
                        g.removeClass("rate-ontxt");
                        $(f).toggleClass("rate-ontxt");
                    }
                }
                $(f).trigger("change");
            }
        }
        if ($(f).hasClass("rate-on")) {
            var j = $(f).attr("mode");
            if (!j) {
                var i = $(f).attr("needfill");
                if (i && !isLoadingAnswer) {
                    showMatrixFill(f);
                    k.stopPropagation();
                }
            }
            showMatrixHeader(f, a);
        }
        if (a.attr("type") == "5") {
            displayRelationByType(a, "a.rate-off", 4);
        }
        jump(a, f);
        if (a.attr("req") != "1" && !c) {
            addClearHref(a);
        }
        $("span.error", a).is(":visible") && validateQ(a);
        if (b) {
            saveMatrixFill(f, c);
        } else {
            saveLikert(a, this);
        }
        saveAnswer(a);
        if ((a.attr("type") == "6" && !c && popUpindex == 0) || (a.attr("type") == "5" && itempopUpindex == 0)) {
            processSamecount(a, this);
        }
        k.preventDefault();
    });
}
var itempopUpindex = 0;
var popUpindex = 0;
function processSamecount(a, e) {
    if (window.IsSampleService) {
        var c = $("a.rate-off", e);
        if (a.attr("type") == "6") {
            var b = c.eq(0).attr("dval");
            var j = $("a.rate-off", a);
            var g = 0;
            for (var f = 0; f < j.length; f++) {
                if (j.eq(f).attr("dval") == b && j.eq(f).hasClass("rate-on")) {
                    g++;
                }
                if (g > 4) {
                    popUpindex++;
                    alert("你有连续多个答案相同，如果你是随意答题，请返回修改，以免答卷提交后无法通过审核");
                    break;
                }
            }
        } else {
            if (a.attr("type") == "5") {
                var b = c.eq(0).attr("val");
                var d = parseInt(a.attr("id").replace("div", "")) - 1;
                var g = 0;
                for (var f = d; f >= 1; f--) {
                    var h = $("#div" + f);
                    if (h.attr("type") != "5") {
                        break;
                    }
                    var j = $("a.rate-off", h);
                    if (j.eq(b - 1).attr("val") == b && j.eq(b - 1).hasClass("rate-on")) {
                        g++;
                    }
                    if (g > 3) {
                        itempopUpindex++;
                        alert("你有连续多个答案相同，如果你是随意答题，请返回修改，以免答卷提交后无法通过审核");
                        break;
                    }
                }
            }
        }
    }
}
function updateCart(c) {
    var n = $("#divQuestion");
    var f = "";
    var k = 0;
    var l = 0;
    var d = null;
    if (shopArray.length > 0) {
        var a = "";
        for (var e = 0; e < shopArray.length; e++) {
            if (shopArray[e].style.display == "none") {
                continue;
            }
            var b = $(shopArray[e]).attr("id");
            if (a) {
                a += ",";
            }
            a += "#" + b;
        }
        if (a) {
            var g = $(a);
            d = $(".shop-item", g);
        }
    } else {
        d = $(".shop-item", n);
    }
    if (!d) {
        return;
    }
    d.each(function (q, t) {
        var p = $(".itemnum", this);
        var u = parseInt(p.val());
        if (u == 0) {
            return true;
        }
        var w = $(".item_name", this).html();
        var r = $(".item_price", this).attr("price");
        var s = u * parseFloat(r);
        var o = '<li class="productitem"><span class="fpname">' + w + '</span><span class="fpnum">' + u + '</span><span class="fpprice">￥' + toFixed0d(s) + "</span></li>";
        f += o;
        k += s;
        l += u;
    });
    var j = 0;
    var m = $(c).find(".shop-item");
    var h = m.length;
    m.each(function (s, p) {
        var o = $(".itemnum", this);
        var u = parseInt(o.val());
        var w = $(".item_name", this).html();
        var q = $(".item_price", this).attr("price");
        var r = u * parseFloat(q);
        j += r;
        if (h == s + 1) {
            var t = toFixed0d(j, 2);
            $(this).nextAll(".li_price").find(".theTotalPrice").html("￥" + t);
            j == 0;
        }
    });
    f = "<ul class='productslist'><li><span class='fpname' style='font-weight:bold; font-size:14px; padding-bottom:16px;'>结算清单</span></li>" + f + '<li class="productitem"><span class="fpname"></span><span class="fpnum" style="color:#333">总金额</span><span class="fpprice" style="color:#de6752;font-size:19px">￥' + toFixed0d(k, 2) + "</span></li></ul>";
    $("#shopcart").html(f);
    if (k > 0) {
        $("#shopcart").show();
    } else {
        $("#shopcart").hide();
    }
    saveAnswer(c);
}
function toFixed0d(a) {
    return a.toFixed(2).replace(".00", "");
}
function setVerifyCode() {
    if (tCode && tCode.style.display != "none") {
        submit_text.value = validate_info_submit_title3;
        submit_text.onblur = function () {
            if (submit_text.value == "") {
                submit_text.value = validate_info_submit_title3;
            }
        };
        submit_text.onfocus = function () {
            if (submit_text.value == validate_info_submit_title3) {
                submit_text.value = "";
            }
        };
        imgCode.style.display = "none";
        submit_text.onclick = function () {
            if (!needAvoidCrack && imgCode.style.display == "none") {
                imgCode.style.display = "";
                imgCode.onclick = refresh_validate;
                imgCode.onclick();
                imgCode.title = validate_info_submit_title1;
            } else {
                if (needAvoidCrack && !imgVerify) {
                    var c = $("#divCaptcha")[0];
                    c.style.display = "";
                    imgVerify = c.getElementsByTagName("img")[0];
                    imgVerify.style.cursor = "pointer";
                    imgVerify.onclick = function () {
                        var h = new Date();
                        var e = h.getTime() + (h.getTimezoneOffset() * 60000);
                        var f = window.location.host || "www.sojump.com";
                        var g = "//" + f + "/botdetect/" + activityId + ".aspx?get=image&c=" + this.captchaId + "&t=" + this.instanceId + "&d=" + e;
                        this.src = g;
                    };
                    var a = imgVerify.getAttribute("captchaid");
                    var b = imgVerify.getAttribute("instanceid");
                    imgVerify.captchaId = a;
                    imgVerify.instanceId = b;
                    imgVerify.onclick();
                }
            }
        };
    }
}
function fixBottom() {
    $("#spanPower").click(function () {
        window.location.href = "https://www.wjx.cn/mobile/index.aspx";
    });
    postHeight();
    var b = $("body").outerHeight();
    var c = document.documentElement.clientHeight;
    var a = b - c;
    if (a < 0) {
        $(".logofooter").addClass("fixedbottom");
    } else {
        $(".logofooter").removeClass("fixedbottom");
    }
}
var firstError = null;
var firstMatrixError = null;
var needSubmitNotValid = false;
var lastFixedObj = null;
var isValidating = false;
function validate(e) {
    var c = true;
    firstError = null;
    firstMatrixError = null;
    curMatrixError = null;
    isValidating = true;
    $(".field:visible").each(function () {
        var g = pageHolder[cur_page].hasExceedTime;
        if (g) {
            return true;
        }
        var f = $(this), a = validateQ(f);
        if (!a) {
            c = false;
        }
    });
    if (!c) {
        if (firstError) {
            $("html, body").animate({scrollTop: $(firstError).offset().top}, 600);
            var b = d(function () {
                var g = $(this).scrollTop();
                var f = $(document).height();
                var h = $(this).height();
                var a = parseInt(g) + parseInt(h);
                if (a > f - 100) {
                    $(e).removeClass("fixed-style");
                } else {
                    $(e).addClass("fixed-style");
                }
            }, 300);

            function d(a, g) {
                var f;
                return function (k) {
                    var j = this, i = arguments;
                    var h = function () {
                        a.apply(j, i);
                    };
                    clearTimeout(f);
                    f = setTimeout(h, g);
                };
            }

            if ($("body").height() > $(window).height() + 100) {
                $(window).on("scroll", b);
                lastFixedObj = e;
            }
        }
    } else {
        $(e).removeClass("fixed-style");
        $(window).unbind("scroll");
        lastFixedObj = null;
    }
    isValidating = false;
    return c;
}
var txtCurCity = null;
function openCityBox(g, f, d, h) {
    txtCurCity = g;
    var e = "";
    h = h || "";
    var b = 400;
    if (f == 3) {
        var a = g.getAttribute("province");
        var c = "";
        if (a) {
            c = "&pv=" + encodeURIComponent(a);
        }
        e = "/joinnew/setcitycountymobo2.aspx?activityid=" + activityId + "&ct=" + f + c + "&pos=" + h;
        b = 300;
    } else {
        if (f == 4) {
            var a = g.getAttribute("province");
            var c = "";
            if (a) {
                c = "&pv=" + encodeURIComponent(a);
            }
            e = "/joinnew/school.aspx?activityid=" + activityId + "&ct=" + f + c + "&pos=" + h;
        } else {
            if (f == 5) {
                e = "/joinnew/setmenusel.aspx?activityid=" + activityId + "&ct=" + f + "&pos=" + h;
            } else {
                if (f == 6) {
                    e = "/wjx/join/amap.aspx?activityid=" + activityId + "&ct=" + f + "&pos=" + h;
                    if ($(g).attr("needonly") == "1") {
                        e += "&nc=1";
                        if (g.value) {
                            $(g.parentNode.parentNode).find(".errorMessage").html("提示：定位后无法修改。");
                            return;
                        }
                    }
                } else {
                    e = "/joinnew/setcitymobo2.aspx?activityid=" + activityId + "&ct=" + f + "&pos=" + h;
                    b = 250;
                }
            }
        }
    }
    g.blur();
    openDialogByIframe(400, b, e);
}
function showItemDesc(c, i, b, d) {
    var a = document.getElementById(b);
    var e = $.trim(a.innerHTML);
    if (e.indexOf("http") == 0) {
        openDialogByIframe(c, i, e, true);
    } else {
        a.style.display = "";
        a.style.width = (Math.min($(window).width(), 400) - 50) + "px";
        var g = a.offsetHeight + 20;
        a.style.display = "none";
        var h = $(window).height() - 30;
        var f = true;
        if (g < h && g > 30) {
            i = g;
            f = false;
        }
        openDialogByIframe(c, i, b, f);
    }
}
function setCityBox(c, a) {
    txtCurCity.value = c;
    if (a && c && $(txtCurCity).parent().hasClass("getLocalBtn")) {
        $(txtCurCity).parent().prev().text(c).show();
    }
    $("#yz_popTanChuClose").click();
    if (window.needSaveJoin) {
        var b = $(txtCurCity).parents(".field");
        saveAnswer(b);
    }
}
var startAge = 0;
var endAge = 0;
var rName = "";
var gender = 0;
var marriage = 0;
var education = "";
function getRname(n, m, l) {
    if (rName) {
        return;
    }
    if ($(m).attr("ceshi")) {
        return;
    }
    if (n == "9") {
        var b = m[0].getElementsByTagName("td");
        if (b.length > 0) {
            for (var g = 0; g < b.length; g++) {
                if (b[g].innerHTML.indexOf("姓名") > -1 || (b[g].innerHTML.indexOf("姓") > -1 && b[g].innerHTML.indexOf("名") > -1)) {
                    var h = b[g].parentNode.id;
                    var p = h.charAt(h.length - 1) == "t";
                    var o = null;
                    if (p) {
                        o = $(b[g].parentNode).next().find("input");
                    } else {
                        o = b[g].parentNode.getElementsByTagName("input");
                    }
                    if (o[0]) {
                        rName = o[0].value;
                    }
                    break;
                }
            }
        } else {
            var f = m[0].innerHTML.indexOf("姓名");
            var e = m[0].innerHTML.indexOf("姓");
            var d = m[0].innerHTML.indexOf("名");
            if (f > -1 || (e > -1 && d > -1)) {
                if (f == -1) {
                    f = d;
                }
                var j = m[0].getElementsByTagName("input");
                for (var g = 0; g < j.length; g++) {
                    var c = j[g].id;
                    var k = m[0].innerHTML.indexOf(c);
                    if (k > f) {
                        rName = j[g].value;
                        break;
                    }
                }
            }
        }
        return;
    }
    if (l.indexOf("姓名") == -1) {
        return;
    }
    if (n == "1") {
        rName = $("input", m).val();
    } else {
        if (n == "2" && l.length <= 5) {
            rName = $("textarea", m).val();
        }
    }
}
function getGender(d, c, e, b) {
    if (d != "3") {
        return;
    }
    if (e.indexOf("性别") == -1) {
        return;
    }
    b.each(function (a) {
        if (this.checked) {
            var f = $(this.parentNode.parentNode).find(".label").html();
            if (f.indexOf("男") > -1) {
                gender = 1;
            } else {
                if (f.indexOf("女") > -1) {
                    gender = 2;
                }
            }
            return false;
        }
    });
}
function getMarriage(d, c, e, b) {
    if (d != "3") {
        return;
    }
    if (e.indexOf("婚姻") == -1) {
        return;
    }
    if (marriage) {
        return;
    }
    b.each(function (a) {
        if (this.checked) {
            var f = $(this.parentNode.parentNode).find(".label").html();
            if (f.indexOf("未婚") > -1) {
                marriage = 1;
            } else {
                if (f.indexOf("已婚") > -1 || f.indexOf("离异") > -1) {
                    marriage = 2;
                }
            }
            return false;
        }
    });
}
function getEducation(d, c, e, b) {
    if (d != "3") {
        return;
    }
    if (e.indexOf("学历") == -1 && e.indexOf("学位") == -1) {
        return;
    }
    if (education) {
        return;
    }
    b.each(function (a) {
        if (this.checked) {
            var f = $(this.parentNode.parentNode).find(".label").html();
            if (f.indexOf("硕士") > -1 || f.indexOf("博士") > -1 || f.indexOf("研究生") > -1) {
                education = 5;
            } else {
                if (f.indexOf("本科") > -1) {
                    education = 4;
                } else {
                    if (f.indexOf("大专") > -1 || f.indexOf("专科") > -1) {
                        education = 3;
                    } else {
                        if (f.indexOf("高中") > -1 || f.indexOf("中专") > -1 || f.indexOf("职高") > -1) {
                            education = 2;
                        } else {
                            if (f.indexOf("初中") > -1 || f.indexOf("小学") > -1) {
                                education = 1;
                            }
                        }
                    }
                }
            }
            return false;
        }
    });
}
function checkJpMatch(c, b) {
    if (jpmatch) {
        return;
    }
    if (b.hasCheck) {
        return;
    }
    b.hasCheck = true;
    var f = $("div.field-label", b).html();
    var e = matchJp(f);
    if (e) {
        jpmatch = e;
        return;
    }
    if (c != "3" && c != "4") {
        return;
    }
    var d = $("div.label", b);
    d.each(function (g) {
        var a = this.innerHTML;
        e = matchJp(a);
        if (e) {
            jpmatch = e;
            return false;
        }
    });
}
function checkTitleDescMatch() {
    var c = document.title || "";
    var b = $("#divDesc").text();
    var a = matchJp(c + b);
    if (a) {
        jpmatch = a;
        return;
    }
}
function matchJp(c) {
    for (var a = 0; a < jpkeyword.length; a++) {
        var b = jpkeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 1;
        }
    }
    for (var a = 0; a < enkeyword.length; a++) {
        var b = enkeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 2;
        }
    }
    for (var a = 0; a < enhighkeyword.length; a++) {
        var b = enhighkeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 3;
        }
    }
    for (var a = 0; a < enmiddlekeyword.length; a++) {
        var b = enmiddlekeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 4;
        }
    }
    for (var a = 0; a < enmiddlexiaokeyword.length; a++) {
        var b = enmiddlexiaokeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 5;
        }
    }
    for (var a = 0; a < enxiaokeyword.length; a++) {
        var b = enxiaokeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 6;
        }
    }
    for (var a = 0; a < enyouerkeyword.length; a++) {
        var b = enyouerkeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 7;
        }
    }
    for (var a = 0; a < enforeinkeyword.length; a++) {
        var b = enforeinkeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 8;
        }
    }
    for (var a = 0; a < enninekeyword.length; a++) {
        var b = enninekeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 9;
        }
    }
    for (var a = 0; a < entenkeyword.length; a++) {
        var b = entenkeyword[a];
        if (c && c.indexOf(b) > -1) {
            return 10;
        }
    }
    for (var a = 0; a < en11keyword.length; a++) {
        var b = en11keyword[a];
        if (c && c.indexOf(b) > -1) {
            return 11;
        }
    }
    for (var a = 0; a < en12keyword.length; a++) {
        var b = en12keyword[a];
        if (c && c.indexOf(b) > -1) {
            return 12;
        }
    }
    return 0;
}
function getAge(i, h, f, j) {
    if (i != "3" && i != "7") {
        return;
    }
    if (f.indexOf("年龄") == -1) {
        return;
    }
    var b = "";
    var g = 0;
    if (i == 3) {
        j.each(function (a) {
            if (this.checked) {
                b = $(this.parentNode.parentNode).find(".label").html();
                g = a;
                return false;
            }
        });
    } else {
        if (i == 7) {
            var e = $("select", h)[0];
            b = e.options[e.selectedIndex].text;
            g = e.selectedIndex - 1;
        }
    }
    if (!b) {
        return;
    }
    var d = /[1-9][0-9]*/g;
    var c = b.match(d);
    if (!c || c.length == 0) {
        return;
    }
    if (c.length > 2) {
        return;
    }
    if (c.length == 2) {
        startAge = c[0];
        endAge = c[1];
    } else {
        if (c.length == 1) {
            if (g == 0) {
                endAge = c[0];
            } else {
                startAge = c[0];
            }
        }
    }
}
function getAnswer(g, o, k, h) {
    var l = 0;
    switch (k) {
        case"1":
            if (!h) {
                o._value = "(跳过)";
                if (g.attr("hrq") == "1") {
                    o._value = "Ⅳ";
                }
                break;
            }
            var e = $("input", g);
            var c = $.trim(e.val());
            if (!c && g.attr("req") == "1" && e[0] && e[0].svalue) {
                c = e[0].svalue;
            }
            if (c && e[0].lnglat) {
                c = c + "[" + e[0].lnglat + "]";
            }
            o._value = replace_specialChar(c);
            break;
        case"2":
            if (!h) {
                o._value = "(跳过)";
                if (g.attr("hrq") == "1") {
                    o._value = "Ⅳ";
                }
                break;
            }
            var e = $("textarea", g);
            var c = $.trim(e.val());
            if (!c && g.attr("req") == "1" && e[0] && e[0].svalue) {
                c = e[0].svalue;
            }
            if (c && e[0].lnglat) {
                c = c + "[" + e[0].lnglat + "]";
            }
            o._value = replace_specialChar(c);
            break;
        case"3":
            if (!h) {
                o._value = "-3";
                if (g.attr("hrq") == "1") {
                    o._value = "-4";
                }
                break;
            }
            $("input[type='radio']:checked", g).each(function (p) {
                o._value = $(this).val();
                var a = $(this).attr("rel");
                if (a && $("#" + a).val().length > 0) {
                    o._value += spChars[2] + replace_specialChar($("#" + a).val().substring(0, 3000));
                }
                return false;
            });
            break;
        case"4":
            if (!h) {
                o._value = "-3";
                if (g.attr("hrq") == "1") {
                    o._value = "-4";
                }
                break;
            }
            var j = 0;
            $("input:checked", g).each(function () {
                var p = this.parentNode.parentNode.style.display == "none";
                if (!p) {
                    if (j > 0) {
                        o._value += spChars[3];
                    }
                    o._value += $(this).val();
                    var a = $(this).attr("rel");
                    if (a && $("#" + a).val().length > 0) {
                        o._value += spChars[2] + replace_specialChar($("#" + a).val().substring(0, 3000));
                    }
                    j++;
                }
            });
            if (j == 0) {
                o._value = "-2";
            }
            break;
        case"21":
            if (!h) {
                o._value = "-3";
                break;
            }
            var j = 0;
            $(".shop-item .itemnum", g).each(function (a) {
                var p = $(this).val();
                if (p != "0") {
                    if (j > 0) {
                        o._value += spChars[3];
                    }
                    o._value += (a + 1);
                    o._value += spChars[2] + p;
                    j++;
                }
            });
            if (j == 0) {
                o._value = "-2";
            }
            break;
        case"11":
            var d = new Array();
            $("li.ui-li-static", g).each(function () {
                var p = $(this).find("span.sortnum").html();
                if (this.style.display == "none") {
                    p = "";
                }
                var q = new Object();
                q.sIndex = p;
                var r = $(this).find("input:hidden").val();
                var a = $(this).find("input.OtherText");
                if (a.length > 0 && a.val().length > 0) {
                    r += spChars[2] + replace_specialChar(a.val().substring(0, 3000));
                }
                if (!h) {
                    r = "-3";
                } else {
                    if (!p) {
                        r = "-2";
                    }
                }
                q.val = r;
                if (!q.sIndex) {
                    q.sIndex = 10000;
                }
                d.push(q);
            });
            d.sort(function (q, p) {
                return q.sIndex - p.sIndex;
            });
            for (var f = 0; f < d.length; f++) {
                if (f > 0) {
                    o._value += ",";
                }
                o._value += d[f].val;
            }
            break;
        case"5":
            if (!h) {
                o._value = "-3";
                break;
            }
            o._value = $("input:hidden", g).val();
            break;
        case"6":
            l = 0;
            $("input:hidden", g).each(function (p) {
                if (l > 0) {
                    o._value += ",";
                }
                var q = false;
                var t = (p + 1);
                if (window.hasReferClient) {
                    var s = $(g).attr("id");
                    var r = o._topic;
                    if (s) {
                        var a = s.replace("div", "");
                        if (parseInt(a) == a && r != a) {
                            r = a;
                        }
                    }
                    var u = document.getElementById("drv" + r + "_" + (p + 1));
                    if (u && u.style.display == "none") {
                        q = true;
                    } else {
                        if (!u && questionsObject[o._topic]) {
                            q = true;
                        }
                    }
                }
                o._value += t + spChars[4];
                if (!h) {
                    o._value += "-3";
                } else {
                    var v = $(this).val();
                    if (!v) {
                        v = "-2";
                    }
                    if (q) {
                        v = "-4";
                    }
                    o._value += v;
                }
                l++;
            });
            break;
        case"7":
            if (!h) {
                o._value = "-3";
                break;
            }
            o._value = $("select", g).val();
            break;
        case"8":
            if (!h) {
                o._value = "(跳过)";
                break;
            }
            o._value = $("input.ui-slider-input", g).val();
            break;
        case"9":
            l = 0;
            if (!h && g.attr("hrq") == "1") {
                o._value = "Ⅳ";
                break;
            }
            var m = $("input", g);
            if (g.attr("randomrow") == "1") {
                var i = g.attr("topic");
                m = m.toArray().sort(function (r, q) {
                    var p = $(r).attr("id").replace("q" + i + "_", "");
                    var s = $(q).attr("id").replace("q" + i + "_", "");
                    return p - s;
                });
            }
            $(m).each(function () {
                if (l > 0) {
                    o._value += spChars[2];
                }
                var p = this.getAttribute("rowid");
                if (p) {
                    o._value += p + spChars[4];
                }
                var r = $.trim($(this).val());
                if (!r && g.attr("req") == "1" && this.svalue) {
                    r = this.svalue;
                }
                var a = false;
                if (window.hasReferClient) {
                    var q = this.parentNode.parentNode.parentNode;
                    if (q && q.tagName == "TR" && q.style.display == "none") {
                        a = true;
                    }
                }
                if (!h) {
                    r = "(跳过)";
                } else {
                    if (a) {
                        r = "Ⅳ";
                    }
                }
                if (r && this.lnglat) {
                    r = r + "[" + this.lnglat + "]";
                }
                o._value += replace_specialChar(r);
                l++;
            });
            break;
        case"12":
            l = 0;
            $("input", g).each(function () {
                if (l > 0) {
                    o._value += spChars[2];
                }
                var a = false;
                if (window.hasReferClient) {
                    var r = this.parentNode.parentNode.parentNode;
                    if (r && r.style.display == "none") {
                        a = true;
                    }
                }
                var p = this.getAttribute("rowid");
                if (p) {
                    o._value += p + spChars[4];
                }
                var q = $(this).val();
                if (!h) {
                    q = "(跳过)";
                } else {
                    if (a) {
                        q = "Ⅳ";
                    }
                }
                o._value += q;
                l++;
            });
            break;
        case"13":
            if (!h) {
                o._value = "(跳过)";
                break;
            }
            o._value = $(g)[0].fileName || "";
            break;
        case"10":
            l = 0;
            var n = "input";
            var b = "(跳过)";
            if (g.attr("select") == "1") {
                n = "select";
                b = "-3";
            }
            $("table", g).each(function () {
                var s = this;
                if (l > 0) {
                    o._value += spChars[2];
                }
                var a = 0;
                var p = false;
                if (window.hasReferClient) {
                    var r = s.parentNode;
                    if (r && r.style.display == "none") {
                        p = true;
                    }
                }
                var q = s.parentNode.getAttribute("rowid");
                if (q) {
                    o._value += q + spChars[4];
                }
                $(n, this).each(function () {
                    if (a > 0) {
                        o._value += spChars[3];
                    }
                    var t = this;
                    var u = t.value;
                    if (!h) {
                        u = b;
                    } else {
                        if (p) {
                            u = "Ⅳ";
                        }
                    }
                    if (u && t.lnglat) {
                        u = u + "[" + t.lnglat + "]";
                    }
                    o._value += replace_specialChar(u);
                    a++;
                });
                l++;
            });
            break;
    }
}
function debugLog(a) {
    console.log(a);
   /* if (window.debug && window.debug.log) {
        debug.log(a);
    }*/
}
var clientAnswerSend = "";
function groupAnswer(q) {
    var c = new Array();
    var w = 0;
    var n = new Object();
    var g = 1;
    debugLog("获取题目答案");
    allQArray.each(function () {
        var H = $(this);
        var G = new Object();
        var D = H.attr("type");
        var i = this.style.display != "none";
        if (i && hasSkipPage) {
            if (this.pageParent && this.pageParent.skipPage) {
                i = false;
            }
        }
        if (this.isCepingQ) {
            i = true;
        }
        if (this.isChuangGuanQ) {
            i = true;
        }
        G._value = "";
        G._topic = getTopic(H);
        if (window.isKaoShi && window.randomMode && H.attr("nc") != "1") {
            n[G._topic] = g;
            g++;
        }
        c[w++] = G;
        try {
            var F = $("div.field-label", H).html();
            if (D == "3" || D == "7") {
                var e = null;
                if (D == "3") {
                    e = $("input[type='radio']", H);
                }
                getAge(D, H, F, e);
                if (D == "3") {
                    getGender(D, H, F, e);
                    getMarriage(D, H, F, e);
                    getEducation(D, H, F, e);
                }
            }
            getRname(D, H, F);
        } catch (E) {
        }
        getAnswer(H, G, D, i);
    });
    if (c.length == 0) {
        alert("提示：此问卷没有添加题目，不能提交！");
        return;
    }
    c.sort(function (i, e) {
        return i._topic - e._topic;
    });
    var m = "";
    for (t = 0; t < c.length; t++) {
        if (t > 0) {
            m += spChars[1];
        }
        m += c[t]._topic;
        m += spChars[0];
        m += c[t]._value;
    }
    debugLog("获取提交参数");
    try {
        if (window.isKaoShi && window.randomMode && n && window.localStorage && window.JSON) {
            var k = localStorage.getItem("sortactivity");
            if (!k) {
                k = activityId;
            } else {
                k += "," + activityId;
            }
            k += "";
            var a = k.split(",");
            var h = 2;
            if (a.length > h) {
                var u = a.length;
                for (var t = 0; t < u - h; t++) {
                    var B = a[0];
                    a.splice(0, 1);
                    localStorage.removeItem("sortorder_" + B);
                }
                k = a.join(",");
            }
            localStorage.setItem("sortactivity", k);
            var C = "sortorder_" + activityId;
            localStorage.setItem(C, JSON.stringify(n));
        }
    } catch (x) {
    }
    var b = $("#form1").attr("action");
    if (b.indexOf("aliyun.sojump.com") > -1 || b.indexOf("temp.sojump.com") > -1) {
        b = b.replace("aliyun.sojump.com", window.location.host).replace("temp.sojump.com", window.location.host);
    }
    var f = b + "&starttime=" + encodeURIComponent($("#starttime").val());
    var v = window.sojumpParm;
    if (!window.hasEncode) {
        v = encodeURIComponent(v);
    }
    if (window.sojumpParm) {
        f += "&sojumpparm=" + v;
    }
    if (window.tparam) {
        f += "&tparam=1&sojumpparmext=" + encodeURIComponent(window.sojumpparmext);
    }
    if (window.Password) {
        f += "&psd=" + encodeURIComponent(Password);
    }
    if (window.PasswordExt) {
        f += "&pwdext=" + encodeURIComponent(PasswordExt);
    }
    if (window.hasMaxtime) {
        f += "&hmt=1";
    }
    if (window.initMaxSurveyTime) {
        f += "&mst=" + window.initMaxSurveyTime;
    }
    if (tCode && tCode.style.display != "none" && submit_text.value != "") {
        f += "&validate_text=" + encodeURIComponent(submit_text.value);
    }
    if (window.useAliVerify) {
        f += "&nc_csessionid=" + encodeURIComponent(nc_csessionid) + "&nc_sig=" + encodeURIComponent(nc_sig) + "&nc_token=" + encodeURIComponent(nc_token) + "&nc_scene=" + nc_scene + "&validate_text=geet";
    }
    if (window.cpid) {
        f += "&cpid=" + cpid;
    }
    if (window.guid) {
        f += "&emailguid=" + guid;
    }
    if (window.udsid) {
        f += "&udsid=" + window.udsid;
    }
    if (window.fromsour) {
        f += "&fromsour=" + window.fromsour;
    }
    if (window.isDingDing) {
        f += "&isdd=1";
        if (window.ddnickname) {
            f += "&ddnn=" + encodeURIComponent(window.ddnickname);
        }
    }
    if (nvvv) {
        f += "&nvvv=1";
    }
    if (window.sjUser) {
        f += "&sjUser=" + encodeURIComponent(sjUser);
    }
    if (window.FromSj) {
        f += "&fromsj=1";
    }
    if (window.outuser) {
        f += "&outuser=" + encodeURIComponent(outuser);
        if (window.outsign) {
            f += "&outsign=" + encodeURIComponent(outsign);
        }
    }
    if (window.sourceurl) {
        f += "&source=" + encodeURIComponent(sourceurl);
    } else {
        f += "&source=directphone";
    }
    var z = window.alipayAccount || window.cAlipayAccount;
    if (z) {
        f += "&alac=" + encodeURIComponent(z);
    }
    if (window.SJBack) {
        f += "&sjback=1";
    }
    if (window.jiFen && jiFen > 0) {
        f += "&jf=" + jiFen;
    }
    if (q) {
        f += "&submittype=" + q;
    }
    if (q == 3) {
        f += "&zbp=" + (cur_page + 1);
        if (needSubmitNotValid) {
            f += "&nsnv=1";
        }
    }
    if (window.isChuangGuan == 2 && q == 1) {
        if (!hasChuGuanSuc) {
            f += "&hmt=1";
        }
        if (window.totalUseTime == 0) {
            totalUseTime = 1;
        }
        f += "&icg=1&tuti=" + totalUseTime;
    }
    if (window.rndnum) {
        f += "&rn=" + encodeURIComponent(rndnum);
    }
    if (imgVerify) {
        f += "&btuserinput=" + encodeURIComponent(submit_text.value);
        f += "&btcaptchaId=" + encodeURIComponent(imgVerify.captchaId);
        f += "&btinstanceId=" + encodeURIComponent(imgVerify.instanceId);
    }
    if (window.inviteid) {
        f += "&inviteid=" + encodeURIComponent(inviteid);
    }
    if (window.access_token && window.openid) {
        f += "&access_token=" + encodeURIComponent(access_token);
        if (window.isQQLogin) {
            f += "&qqopenid=" + encodeURIComponent(openid);
        } else {
            f += "&openid=" + encodeURIComponent(openid);
        }
    }
    if (window.wxUserId) {
        f += "&wxUserId=" + window.wxUserId;
    }
    if (window.wxthird) {
        f += "&wxthird=1";
    }
    if (window.parterts) {
        f += "&parterts=" + parterts;
    }
    if (window.parterjoiner) {
        f += "&parterjoiner=" + encodeURIComponent(parterjoiner);
    }
    if (window.partersign) {
        f += "&partersign=" + encodeURIComponent(partersign);
    }
    if (window.parterrealname) {
        f += "&parterrealname=" + encodeURIComponent(parterrealname);
    }
    if (window.parterextf) {
        f += "&parterextf=" + encodeURIComponent(parterextf);
    }
    if (window.isKaoShi && rName) {
        f += "&rname=" + encodeURIComponent(rName.replace("(", "（").replace(")", "）"));
    }
    if (window.relts) {
        f += "&relts=" + relts;
    }
    if (window.relusername) {
        f += "&relusername=" + encodeURIComponent(relusername);
    }
    if (window.relsign) {
        f += "&relsign=" + encodeURIComponent(relsign);
    }
    if (window.relrealname) {
        f += "&relrealname=" + encodeURIComponent(relrealname);
    }
    if (window.reldept) {
        f += "&reldept=" + encodeURIComponent(reldept);
    }
    if (window.relext) {
        f += "&relext=" + encodeURIComponent(relext);
    }
    if (window.corpId) {
        f += "&corpId=" + encodeURIComponent(corpId);
    }
    if (lastCostTime && lastCostTime / 1000) {
        f += "&lct=" + (parseInt(lastCostTime / 1000));
    }
    if (window.isWeiXin) {
        f += "&iwx=1";
    }
    f += "&t=" + new Date().valueOf();
    if ($("#shopcart")[0] && $("#shopcart")[0].style.display != "none") {
        f += "&ishop=1";
    }
    if (window.cProvince) {
        f += "&cp=" + encodeURIComponent(cProvince.replace("'", "")) + "&cc=" + encodeURIComponent(cCity.replace("'", "")) + "&ci=" + escape(cIp);
        var o = cProvince + "," + cCity;
        var r = window.location.host || "sojump.com";
        try {
            setCookie("ip_" + cIp, o, null, "/", "", null);
        } catch (y) {
        }
    }
    debugLog("准备提交到服务器");
    $("#ctlNext").hide();
    var A = "处理中......";
    A = '<img src = "/images/wjxMobile/wait.gif" alt="">';
    $("#ValError").html(A);
    if (q == 3) {
        A = "正在验证，请稍候...";
        if (langVer == 1) {
            A = "Validating......";
        }
        $("#ValError").html(A);
    }
    var d = {submitdata: m};
    var l = false;
    var j = window.getMaxWidth || 1800;
    var s = encodeURIComponent(m);
    if (window.submitWithGet && s.length <= j) {
        l = true;
    }
    clientAnswerSend = m;
    debugLog("开始提交");
    if (l) {
        f += "&submitdata=" + s;
        f += "&useget=1";
    } else {
        if (window.submitWithGet) {
            window.postIframe = 1;
        }
    }
    var p = "很抱歉，网络连接异常，请重新尝试提交！";
    if (langVer == 1) {
        p = "Sorry,network error,please retry later.";
    }
    if (window.postIframe) {
        debugLog("postIframe");
        postWithIframe(f, m);
    } else {

            debugLog("ajaxpost");
            $.ajax({
                type: "POST", url: f, data: d, dataType: "json", success: function (e) {
                   // afterSubmit(e, q);

                    if(e.code=="200")
                    {
                        window.location=e.url;
                    }
                    else
                    {
                        alert(e.message);
                        $("#ValError").html(p);
                        $("#ctlNext").show();
                        return;
                    }

                }, error: function () {
                    $("#ValError").html(p);
                    $("#ctlNext").show();
                    return;
                }
            });



    }
}
function postWithIframe(b, c) {
    var a = document.createElement("div");
    a.style.display = "none";
    a.innerHTML = "<iframe id='mainframe' name='mainframe' style='display:none;' > </iframe><form target='mainframe' data-ajax='false' id='frameform' action='' method='post' enctype='application/x-www-form-urlencoded'><input  value='' id='submitdata' name='submitdata' type='hidden'><input type='submit' value='提交' ></form>";
    document.body.appendChild(a);
    document.getElementById("submitdata").value = c;
    var d = document.getElementById("frameform");
    d.action = b + "&iframe=1";
    d.submit();
}
var havereturn = false;
var timeoutTimer = null;
function processError(c, b, a) {
    if (!havereturn) {
        havereturn = true;
        $("#ValError").html("提交超时，请检查网络是否异常！");
        $("#ctlNext").show();
    }
    if (timeoutTimer) {
        clearTimeout(timeoutTimer);
    }
}
var nvvv = 0;
function addtolog(d) {
    var b = document.createElement("img");
    var a = window.isWeiXin ? 1 : 0;
    var e = window.isVip ? 1 : 0;
    var c = window.LogStoreLocal ? "activityfinishtest" : "activityfinish";
  //  b.src = "//sojump.cn-hangzhou.log.aliyuncs.com/logstores/" + c + "/track.gif?APIVersion=0.6.0&activity=" + activityId + "&source=1&weixin=" + a + "&vip=" + e + "&qtype=" + cqType;
}
function afterSubmit(v, m) {
    $("#ValError").html("");
    havereturn = true;
    debugLog("提交成功");
    var o = v.split("〒");

    refresh_validate();
}
function clearFieldValue(c) {
    if (isLoadingAnswer) {
        return;
    }
    var d = $(c).attr("type");
    if (d == "3") {
        if ($(c).attr("qingjing") == "1") {
            return;
        }
        $("input[type='radio']:checked", $(c)).each(function () {
            this.checked = false;
            $(this).parent().parent().find("a.jqradio").removeClass("jqchecked");
        });
        $("input.OtherRadioText", $(c)).each(function () {
            if (this.value) {
                $(this).val("").blur();
            }
        });
    } else {
        if (d == "4") {
            $("input:checked", $(c)).each(function () {
                this.checked = false;
                $(this).parent().parent().find("a.jqcheck").removeClass("jqchecked");
            });
        } else {
            if (d == "6" || d == "5") {
                $("a.rate-off", $(c)).each(function () {
                    $(this).removeClass("rate-on");
                    var a = $(this).attr("mode");
                    if (a) {
                        $(this).removeClass("rate-on" + a);
                    } else {
                        $(this).removeClass("rate-ontxt");
                    }
                });
                $("#divMatrixHeader").hide();
                if (d == "5") {
                    saveLikert(c);
                }
            } else {
                if (d == "7") {
                    if ($("select", $(c)).val() != "-2") {
                        $("select", $(c)).val("-2").trigger("change");
                    }
                } else {
                    if (d == "8") {
                        var e = $("input", $(c));
                        if (e.val()) {
                            e.val("").change();
                        }
                    } else {
                        if (d == "9") {
                            $("input.ui-slider-input", $(c)).each(function () {
                                if (this.value) {
                                    $(this).val("").change();
                                }
                            });
                        } else {
                            if (d == "11") {
                                $("li.ui-li-static", $(c)).each(function () {
                                    $(this).find("span.sortnum").html("").removeClass("sortnum-sel");
                                    $(this).attr("check", "");
                                });
                            }
                        }
                    }
                }
            }
        }
    }
}
function validateQ(p) {
    var h = $(p).attr("req"), l = $(p).attr("type"), o = true;
    var k = $(p)[0];
    var f = "";
    var e = $(p).attr("hasjump");
    if (l == "1") {
        var i = $("input", $(p));
        var d = replace_specialChar($.trim(i.val()));
        o = d.length == 0 ? false : true;
        if ($(i[0]).attr("verify") == "密码") {
            i[0].needCheckConfirm = true;
        }
        f = verifyTxt(p, i);
        if (!f && d) {
            i[0].svalue = d;
        }
    } else {
        if (l == "21" && h == "1") {
            var n = 0;
            $(".shop-item .itemnum", p).each(function (a) {
                var b = $(this).val();
                if (b && b != "0") {
                    n++;
                }
            });
            if (n == 0) {
                o = false;
            }
        } else {
            if (l == "2") {
                var i = $("textarea", $(p));
                var d = replace_specialChar($.trim(i.val()));
                o = d.length == 0 ? false : true;
                f = verifyTxt(p, i);
                if (!f && d) {
                    i[0].svalue = d;
                }
            } else {
                if (l == "3") {
                    o = false;
                    $(p).find("input:checked").each(function () {
                        o = true;
                        if (this.getAttribute("jumpto") == -1) {
                            needSubmitNotValid = true;
                        }
                        var a = $(this).attr("rel");
                        if (a) {
                            var b = $("#" + a);
                            if (b.attr("required") && b.val().length == 0) {
                                f = "文本框内容必须填写！";
                                if (langVer == 1) {
                                    f = "Please enter a value.";
                                }
                                writeError(p, f, 3000);
                                return false;
                            }
                        }
                    });
                } else {
                    if (l == "4") {
                        o = false;
                        var q = false;
                        $(p).find("input:checked").each(function () {
                            o = true;
                            var a = $(this).attr("rel");
                            if (a) {
                                var b = $("#" + a);
                                if (b.attr("required") && b.val().length == 0) {
                                    f = "文本框内容必须填写！";
                                    if (langVer == 1) {
                                        f = "Please enter a value.";
                                    }
                                    b.focus();
                                    writeError(p, f, 3000);
                                    q = true;
                                    return false;
                                }
                            }
                        });
                        if (!q) {
                            f = verifyCheckMinMax($(p), true);
                        }
                    } else {
                        if (l == "11") {
                            o = $("li.ui-li-static[check='1']", $(p)).length == 0 ? false : true;
                            var q = false;
                            $("li.ui-li-static[check='1']", $(p)).each(function () {
                                o = true;
                                var a = $("input[type='hidden']", $(this)).eq(0).attr("id");
                                if (a) {
                                    var b = $("#tq" + a);
                                    if (b.attr("required") && b.val().length == 0) {
                                        f = "文本框内容必须填写！";
                                        if (langVer == 1) {
                                            f = "Please enter a value.";
                                        }
                                        b.focus();
                                        writeError(p, f, 3000);
                                        q = true;
                                        return false;
                                    }
                                }
                            });
                            if (!q) {
                                f = verifyCheckMinMax($(p), true, true);
                            }
                        } else {
                            if (l == "5") {
                                o = validateScaleRating($(p));
                            } else {
                                if (l == "6") {
                                    f = validateMatrix($(p), h);
                                    if (f) {
                                        writeError(p, f, 1000);
                                        return false;
                                    }
                                } else {
                                    if (l == "7") {
                                        var j = $("select", $(p))[0];
                                        o = j.selectedIndex == 0 ? false : true;
                                        if (o) {
                                            if (j.options[j.selectedIndex] && j.options[j.selectedIndex].getAttribute("jumpto") == -1) {
                                                needSubmitNotValid = true;
                                            }
                                        }
                                    } else {
                                        if (l == "8") {
                                            o = $("input", $(p)).val().length == 0 ? false : true;
                                        } else {
                                            if (l == "9") {
                                                $("input", $(p)).each(function () {
                                                    var a = $(this);
                                                    var c = replace_specialChar($.trim(a.val()));
                                                    if (window.hasReferClient) {
                                                        var b = this.parentNode.parentNode.parentNode;
                                                        if (b && b.style.display == "none") {
                                                            return true;
                                                        }
                                                    }
                                                    if (c.length == 0) {
                                                        o = false;
                                                        if (a.attr("isrequir") == "0") {
                                                            o = true;
                                                        } else {
                                                            return false;
                                                        }
                                                    }
                                                    f = verifyTxt(p, a, true);
                                                    if (f) {
                                                        return false;
                                                    }
                                                    f = checkOnly(p, a);
                                                    if (f) {
                                                        return false;
                                                    } else {
                                                        a[0].svalue = c;
                                                    }
                                                });
                                            } else {
                                                if (l == "12") {
                                                    var m = $(p).attr("total");
                                                    var r = m;
                                                    $("input", $(p)).each(function () {
                                                        var a = $(this);
                                                        if (window.hasReferClient) {
                                                            var c = this.parentNode.parentNode.parentNode;
                                                            if (c && c.style.display == "none") {
                                                                return true;
                                                            }
                                                        }
                                                        var b = a.val();
                                                        if (b.length == 0) {
                                                            o = false;
                                                        }
                                                        if (b) {
                                                            r = r - b;
                                                        }
                                                    });
                                                    if (r != 0) {
                                                        var g = false;
                                                        if (r == m && !h) {
                                                            g = true;
                                                        }
                                                        if (!g) {
                                                            writeError(p, "", 3000);
                                                            return false;
                                                        }
                                                    }
                                                } else {
                                                    if (l == "13") {
                                                        if (!$(p)[0].fileName) {
                                                            o = false;
                                                        }
                                                    } else {
                                                        if (l == "10") {
                                                            var t = "input";
                                                            if ($(p).attr("select") == "1") {
                                                                t = "select";
                                                            }
                                                            var s = true;
                                                            $("table", $(p)).each(function () {
                                                                var a = $(this);
                                                                if (window.hasReferClient) {
                                                                    var b = this.parentNode;
                                                                    if (b && b.style.display == "none") {
                                                                        return true;
                                                                    }
                                                                }
                                                                $(t, a).each(function () {
                                                                    var u = $(this);
                                                                    var v = u.val();
                                                                    var c = this.parentNode.parentNode;
                                                                    if (c && c.style.display != "none") {
                                                                        if (v.length == 0 || (t == "select" && v == "-2")) {
                                                                            if (h == "1") {
                                                                                o = false;
                                                                                p.errorControl = this;
                                                                                return false;
                                                                            }
                                                                        }
                                                                        f = verifyTxt(p, u, true);
                                                                        if (f) {
                                                                            p.errorControl = this;
                                                                            s = false;
                                                                            return false;
                                                                        }
                                                                    }
                                                                });
                                                                if (!s) {
                                                                    return false;
                                                                }
                                                            });
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (!o && h == "1") {
        f = "请回答此题";
        if (l == "1" || l == "2") {
            f = "请输入内容";
        } else {
            if (l == "3" || l == "4" || l == "7") {
                f = "请选择选项";
            } else {
                if (l == "13") {
                    f = "请上传文件";
                } else {
                    if (l == "21") {
                        f = "请选择";
                    }
                }
            }
        }
        if (l == "6" && $(p)[0].isMatrixFillError) {
            f = "请注明原因";
        }
        if (langVer == 1) {
            f = "required";
        }
        writeError(p, f, 1000);
    } else {
        $("span.error", $(p)).hide();
        $("div.field-label", $(p)).css("background", "");
    }
    if (f) {
        return false;
    }
    if (k.removeError) {
        k.removeError();
    }
    return true;
}
function show_prev_page() {
    if (cur_page > 0 && pageHolder[cur_page - 1].hasExceedTime) {
        alert("上一页填写超时，不能返回上一页");
        return;
    }
    var k = $("#divNext")[0];
    var b = $("#divPrev")[0];
    pageHolder[cur_page].style.display = "none";
    k.style.display = "";
    $("#divSubmit").hide();
    cur_page--;
    for (var h = cur_page; h >= 0; h--) {
        if (pageHolder[h].skipPage) {
            cur_page--;
        } else {
            break;
        }
    }
    var e = window.isKaoShi;
    for (var h = cur_page; h >= 0; h--) {
        var l = pageHolder[h].questions;
        var g = false;
        for (var f = 0; f < l.length; f++) {
            var a = l[f];
            if (a.style.display != "none") {
                g = true;
                break;
            }
        }
        var d = false;
        if (!g && pageHolder[h].childNodes && pageHolder[h].childNodes.length > 0) {
            var c = pageHolder[h].cuts;
            if (!c) {
                c = pageHolder[h].cuts = $(".cutfield", pageHolder[h]);
            }
            for (var f = 0; f < c.length; f++) {
                if (c[f].style.display != "none") {
                    d = true;
                    break;
                }
            }
        }
        if (!g && !d && cur_page > 0) {
            cur_page--;
        } else {
            break;
        }
    }
    if (cur_page == 0) {
        b.style.display = "none";
    }
    pageHolder[cur_page].style.display = "";
    pageHolder[cur_page].scrollIntoView();
    showProgress();
}
function show_next_page() {
    var a = $("#divNext a")[0];
    if (a && a.disabled && !isLoadingAnswer) {
        return;
    }
    if (!validate($("#divNext"))) {
        return;
    }
    var b = $(pageHolder[cur_page]).attr("iszhenbie") == "true";
    if (needSubmitNotValid && window.isRunning) {
        $("#divNext").hide();
        groupAnswer(3);
    } else {
        if (b && window.isRunning) {
            $("#divNext").hide();
            groupAnswer(3);
        } else {
            to_next_page();
        }
    }
}
function to_next_page() {
    var m = $("#divNext")[0];
    var b = $("#divPrev")[0];
    b.style.display = displayPrevPage;
    pageHolder[cur_page].style.display = "none";
    cur_page++;
    if (cur_page == 1) {
        $("#divDesc").hide();
        $("#divPromote").hide();
    }
    for (var k = cur_page; k < pageHolder.length; k++) {
        if (pageHolder[k].skipPage) {
            cur_page++;
        } else {
            break;
        }
    }
    var e = window.isKaoShi;
    for (var k = cur_page; k < pageHolder.length; k++) {
        var n = pageHolder[k].questions;
        var h = false;
        for (var f = 0; f < n.length; f++) {
            var a = n[f];
            if (a.style.display != "none") {
                h = true;
                break;
            }
        }
        var d = false;
        if (!h && pageHolder[k].childNodes && pageHolder[k].childNodes.length > 0) {
            var c = pageHolder[k].cuts;
            if (!c) {
                c = pageHolder[k].cuts = $(".cutfield", pageHolder[k]);
            }
            for (var f = 0; f < c.length; f++) {
                if (c[f].style.display != "none") {
                    d = true;
                    break;
                }
            }
        }
        if (!h && !d && cur_page < pageHolder.length - 1) {
            cur_page++;
        } else {
            break;
        }
    }
    var g = true;
    for (var k = cur_page + 1; k < pageHolder.length; k++) {
        if (!pageHolder[k].skipPage) {
            g = false;
        }
    }
    if (cur_page >= pageHolder.length - 1 || g) {
        m.style.display = "none";
        $("#divSubmit").show();
    } else {
        if (cur_page < pageHolder.length - 1) {
            m.style.display = "";
        }
    }
    pageHolder[cur_page].style.display = "";
    initSlider();
    var l = document.getElementById("divMaxTime");
    if (l && l.style.display == "") {
        $("body,html").animate({scrollTop: 0}, 100);
    } else {
        pageHolder[cur_page].scrollIntoView();
    }
    showProgress();
    if (window.hasPageTime) {
        processMinMax();
    }
    if (window.isChuangGuan == 2) {
        $("#divSubmit").hide();
        timeLimit();
    }
    fixBottom();
    $("#divMatrixHeader").hide();
    adjustVideoHeight(pageHolder[cur_page]);
}
function processSearch() {
    if (!document.referrer) {
        return;
    }
    var b = document.referrer;
    var a = false;
    if (b.indexOf("baidu.com") > -1 || b.indexOf("google.com") > -1 || b.indexOf("so.360.cn") > -1 || b.indexOf(".so.com") > -1 || b.indexOf(".sogou.com") > -1 || b.indexOf(".soso.com") > -1 || b.indexOf(".haoso.com") > -1 || b.indexOf(".sm.cn") > -1) {
        a = true;
    }
    if (a) {
        $("#divSearch").show().html('<a href="https://www.wjx.cn/mobile/publicsurveys.aspx" style="color:#66beff;">搜索更多相关问卷模板</a>');
    }
}
function initSlider() {
    if (window.hasSlider) {
        $(pageHolder[cur_page].questions).each(function () {
            var e = $(this);
            var d = e.attr("type");
            if (d == "8" || d == "12" || d == "9" || d == "10") {
                var c = getTopic(e);
                var a = document.getElementById("divRef" + c);
                var b = a && a.style.display == "";
                if (!b) {
                    setTimeout(function () {
                        var f = $("input.ui-slider-input:visible", e);
                        f.rangeslider({polyfill: false});
                    }, 10);
                }
            }
        });
    }
}
function initqSlider(d) {
    if (!window.hasSlider) {
        return;
    }
    var c = $(d);
    var b = c.attr("type");
    var a = b == "8" || b == "12" || b == "9" || b == "10";
    if (!a) {
        return;
    }
    initEleSlider(d);
}
function initEleSlider(a) {
    if (a.hasInitSlider) {
        return;
    }
    var b = $("input.ui-slider-input:visible", a);
    if (!b.rangeslider) {
        return;
    }
    b.rangeslider({polyfill: false});
    a.hasInitSlider = true;
}
function showProgress() {
    if (totalPage == 1) {
        return;
    }
    var d = cur_page + 1;
    if (d > totalPage) {
        d = totalPage;
    }
    var c = d + "/" + totalPage;
    var a = "页";
    if (langVer == 1) {
        a = " Page";
    }
    $(".pagepercent").html(c + a);
    var b = d * 100 / totalPage;
    $(".pagebar").width(b + "%");
}
function verifyCheckMinMax(a, c, j, e) {
    var d = a.attr("minvalue");
    var h = a.attr("maxvalue");
    var g = a[0];
    if (d == 0 && h == 0) {
        return "";
    }
    var f = 0;
    if (j) {
        f = $("li.ui-li-static[check='1']", a).length;
    } else {
        f = $("input:checked", a).length;
    }
    if (f == 0 && !a.attr("req")) {
        return;
    }
    var b = "";
    if (langVer == 0) {
        b = "&nbsp;&nbsp;&nbsp;您已经选择了" + f + "项";
    }
    var i = true;
    if (h > 0 && f > h) {
        if (e) {
            if (langVer == 0) {
                alert("此题最多只能选择" + h + "项");
            }
            if (a.attr("type") == 11 && $(e)[0].type == "text") {
                $(e).parent().parent().trigger("click");
            } else {
                $(e).trigger("click");
            }
            return "";
        }
        if (langVer == 0) {
            b += ",<span style='color:red;'>多选择了" + (f - h) + "项</span>";
        } else {
            b = validate_info + validate_info_check4 + h + type_check_limit5;
        }
        i = false;
    } else {
        if (d > 0 && f < d) {
            if (langVer == 0) {
                b += ",<span style='color:red;'>少选择了" + (d - f) + "项</span>";
            } else {
                b = validate_info + validate_info_check5 + d + type_check_limit5;
            }
            i = false;
            if (!j && f == 1 && $("input:checked", a).parents(".ui-checkbox").hasClass("huchi")) {
                i = true;
            }
        }
    }
    if (!g.errorMessage) {
        g.errorMessage = $(".errorMessage", a)[0];
    }
    if (!i) {
        if (!c) {
            g.errorMessage.innerHTML = b;
        } else {
            writeError(a[0], b, 3000);
        }
        return b;
    } else {
        g.errorMessage.innerHTML = "";
    }
    return "";
}
function checkOnly(e, h) {
    var j = $(h);
    var i = j[0];
    var l = j.attr("needonly");
    if (!l) {
        return "";
    }
    if (j.attr("verify") == "地图") {
        return "";
    }
    var g = j.val();
    if (!g) {
        return "";
    }
    if (g.length > 50) {
        return "";
    }
    var b = getTopic(e);
    var c = j.attr("rowid");
    if (c) {
        b = parseInt(b) * 10000 + parseInt(c);
    } else {
        var a = j.attr("gapindex");
        if (a) {
            b = parseInt(b) * 10000 + parseInt(a);
        }
    }
    var d = "/joinnew/AnswerOnlyHandler.ashx?q=" + activityId + "&at=" + encodeURIComponent(g) + "&qI=" + b + "&o=true&t=" + (new Date()).valueOf();
    var k = $(e)[0];
    var f = "";
    if (!i.errorOnly) {
        i.errorOnly = new Object();
    }
    if (i.errorOnly[g]) {
        f = validate_only;
        if (k.verifycodeinput) {
            k.verifycodeinput.parentNode.style.display = "none";
        }
        if (!k.errorControl && b - 10000 > 0) {
            k.errorControl = i;
        }
        writeError(k, f, 3000);
        return f;
    }
    $.ajax({
        type: "GET", url: d, async: false, success: function (m) {
            if (m == "false1") {
                f = validate_only;
                i.errorOnly[g] = 1;
                if (k.verifycodeinput) {
                    k.verifycodeinput.parentNode.style.display = "none";
                }
                if (!k.errorControl && b - 10000 > 0) {
                    k.errorControl = i;
                }
                writeError(k, f, 3000);
                return f;
            }
            return "";
        }
    });
}
function verifyTxt(a, e, d) {
    var c = $.trim($(e).val());
    var h = $(e).attr("verify");
    var i = $(e).attr("minword");
    var f = $(e).attr("maxword");
    var g = $(a)[0];
    var b = "";
    if (!c) {
        return b;
    }
    if (g.removeError) {
        g.removeError();
    }
    b = verifyMinMax(c, h, i, f);
    if (!b) {
        b = verifydata(c, h, $(e)[0]);
    }
    if (b) {
        if (!g.errorControl && d) {
            g.errorControl = $(e)[0];
        }
        writeError(g, b, 3000);
        return b;
    }
    if (!b && g.needsms && !g.issmsvalid) {
        b = "提示：您的手机号码没有通过验证，请先验证";
        writeError(g, b, 3000);
    }
    return b;
}
function validateMatrix(s, h) {
    var j = $("table.matrix-rating", $(s)), t;
    var g = "";
    $(s)[0].isMatrixFillError = false;
    var k = j[0].rows;
    for (var o = 0; o < k.length; o++) {
        var b = k[o];
        var f = b.getAttribute("tp");
        if (f != "d") {
            continue;
        }
        if (window.hasReferClient && b.style.display == "none") {
            continue;
        }
        var p = $(b).attr("fid"), r = $("a.rate-on", $(b));
        t = "";
        if (r.length == 0) {
            $("#" + p, $(s)).val("");
            if (h == "1") {
                g = "请回答此题";
                if (langVer == 1) {
                    g = "required";
                }
                $(s)[0].errorControl = $(b).prev("tr")[0];
                break;
            } else {
                continue;
            }
        } else {
            t = $(r[r.length - 1]).attr("dval");
            var x = $(s).attr("ischeck");
            if (x) {
                t = "";
                var l = $(s).attr("minvalue");
                var n = $(s).attr("maxvalue");
                if (l && r.length - l < 0) {
                    g = validate_info + validate_info_check5 + l + type_check_limit5;
                    $(s)[0].errorControl = $(b).prev("tr")[0];
                    break;
                } else {
                    if (n && r.length - n > 0) {
                        g = validate_info + validate_info_check4 + n + type_check_limit5;
                        $(s)[0].errorControl = $(b).prev("tr")[0];
                        break;
                    }
                }
                var v = true;
                $(r).each(function () {
                    if (t) {
                        t += ";";
                    }
                    t += $(this).attr("dval");
                    var c = $(this).attr("needfill");
                    if (c) {
                        var d = this.fillvalue || "";
                        d = replace_specialChar(d).replace(/;/g, "；").replace(/,/g, "，");
                        t += spChars[2] + d;
                        var a = $(this).attr("req");
                        if (a && !d) {
                            g = "请回答此题";
                            if (langVer == 1) {
                                g = "required";
                            }
                            $(s)[0].isMatrixFillError = true;
                            showMatrixFill(this, 1);
                            v = false;
                            return false;
                        }
                    }
                });
                if (!v) {
                    break;
                }
            } else {
                var w = $(r[r.length - 1]).attr("mode");
                if (!w) {
                    var m = $(r[r.length - 1]).attr("needfill");
                    if (m) {
                        var q = r[r.length - 1].fillvalue || "";
                        q = replace_specialChar(q).replace(/;/g, "；").replace(/,/g, "，");
                        t += spChars[2] + q;
                        var u = $(r[r.length - 1]).attr("req");
                        if (u && !q) {
                            g = "请回答此题";
                            if (langVer == 1) {
                                g = "required";
                            }
                            $(s)[0].isMatrixFillError = true;
                            showMatrixFill(r[r.length - 1], 1);
                            break;
                        }
                    }
                }
            }
            $("#" + p, $(s)).attr("value", t);
        }
    }
    return g;
}
function validateScaleRating(d) {
    var e = true, f = $("table.scale-rating", $(d));
    var f = $("a.rate-on", f);
    if (f.length == 0) {
        e = false;
        $("input:hidden", $(d)).val("");
    } else {
        $("input:hidden", $(d)).attr("value", $(f[f.length - 1]).attr("val"));
        if (f.attr("jumpto") == -1) {
            needSubmitNotValid = true;
        }
    }
    return e;
}
function jump(c, e) {
    var d = $(c);
    var f = d.attr("hasjump");
    if (f) {
        var b = d.attr("type");
        var a = d.attr("anyjump");
        if (a > 0) {
            jumpAnyChoice(c);
        } else {
            if (a == 0 && b != "3" && b != "5" && b != "7") {
                jumpAnyChoice(c);
            } else {
                jumpByChoice(c, e);
            }
        }
    }
}
function jumpAnyChoice(c, f) {
    var d = $(c);
    var b = d.attr("type");
    var a = false;
    if (b == "1") {
        a = $("input", d).val().length > 0;
    } else {
        if (b == "2") {
            a = $("textarea", d).val().length > 0;
        } else {
            if (b == "3") {
                a = $("input[type='radio']:checked", d).length > 0;
            } else {
                if (b == "4") {
                    a = $("input[type='checkbox']:checked", d).length > 0;
                } else {
                    if (b == "5") {
                        a = $("a.rate-on", d).length > 0;
                    } else {
                        if (b == "6") {
                            a = $("a.rate-on", d).length > 0;
                        } else {
                            if (b == "7") {
                                a = $("select", d).val() != -2;
                            } else {
                                if (b == "8") {
                                    a = $("input", d).val().length > 0;
                                } else {
                                    if (b == "9" || b == "12") {
                                        $("input", d).each(function () {
                                            var g = $(this).val();
                                            if (g.length > 0) {
                                                a = true;
                                            }
                                        });
                                    } else {
                                        if (b == "10") {
                                            var e = d.attr("select") == "1";
                                            if (e) {
                                                $("select", d).each(function () {
                                                    var g = $(this).val();
                                                    if (g != -2) {
                                                        a = true;
                                                    }
                                                });
                                            } else {
                                                $("input", d).each(function () {
                                                    var g = $(this).val();
                                                    if (g.length > 0) {
                                                        a = true;
                                                    }
                                                });
                                            }
                                        } else {
                                            if (b == "11") {
                                                a = $("li[check='1']", d).length > 0;
                                            } else {
                                                if (b == "13") {
                                                    a = d[0].fileName ? true : false;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    jumpAny(a, c, f);
}
function jumpByChoice(e, f) {
    var d = $(e).attr("type");
    var c = $(e)[0];
    if (f.value == "-2") {
        processJ(c.indexInPage - 0, 0);
    } else {
        if (f.value == "-1" || f.value == "") {
            processJ(c.indexInPage - 0, 0);
        } else {
            if ((d == "3" || d == "5" || d == "7")) {
                var g = f.value || $(f).attr("val");
                if (parseInt(g) == g) {
                    var b = $(f).attr("jumpto");
                    if (!b) {
                        b = 0;
                    }
                    var a = b - 0;
                    processJ(c.indexInPage - 0, a);
                }
            }
        }
    }
}
function jumpAny(c, e, g) {
    var f = $(e);
    var d = f.attr("type");
    var h = f.attr("hasjump");
    var a = f.attr("anyjump") - 0;
    var b = f[0];
    if (h) {
        if (c) {
            processJ(b.indexInPage - 0, a, g);
        } else {
            processJ(b.indexInPage - 0, 0, g);
        }
    }
}
function processJ(p, d, e) {
    var a = p + 1;
    var b = cur_page;
    var f = d == 1 || d == -1;
    var q = 0;
    for (var k = cur_page; k < pageHolder.length; k++) {
        var m = pageHolder[k].questions;
        if (f) {
            b = k;
        }
        if (!q && m[p]) {
            q = parseInt(getTopic(m[p]));
        }
        for (var h = a; h < m.length; h++) {
            var l = getTopic(m[h]);
            if (l == d || f) {
                b = k;
            }
            if ($(m[h]).attr("nhide") == "1") {
                continue;
            }
            if (l < d || f) {
                m[h].style.display = "none";
            } else {
                if (relationNotDisplayQ[l]) {
                    var g = 1;
                } else {
                    m[h].style.display = "";
                }
                var c = $(m[h]).attr("hasjump");
                if (c && !e) {
                    clearFieldValue(m[h]);
                }
            }
        }
        if (!pageHolder[k].cuts) {
            pageHolder[k].cuts = $(".cutfield", pageHolder[k]);
        }
        for (var h = 0; h < pageHolder[k].cuts.length; h++) {
            var o = pageHolder[k].cuts[h];
            if (f) {
                o.style.display = "none";
            }
            var l = o.getAttribute("qtopic");
            if (!l) {
                continue;
            }
            if (o.getAttribute("relation")) {
                continue;
            }
            if (q && l <= q) {
                continue;
            } else {
                if (l <= a) {
                    continue;
                }
            }
            if (l < d || f) {
                o.style.display = "none";
            } else {
                var n = o.getAttribute("topic");
                if (relationNotDisplayQ[n]) {
                    var g = 1;
                } else {
                    o.style.display = "";
                }
            }
        }
        a = 0;
    }
    fixBottom();
}
function GetBacktoServer() {
    str = window.location.pathname;
    index = str.lastIndexOf("/");
    page = str.substr(index + 1, str.length - index);
    data = readCookie("history");
    if (data != null && data.toLowerCase() != page.toLowerCase()) {
        window.location.href = window.location.href;
    }
}
function readCookie(h) {
    for (var j = h + "=", i = document.cookie.split(";"), f = 0; f < i.length; f++) {
        var g = i[f];
        while (g.charAt(0) == " ") {
            g = g.substring(1, g.length);
        }
        if (g.indexOf(j) == 0) {
            return g.substring(j.length, g.length);
        }
    }
    return null;
}
function removeError() {
    if (this.errorMessage) {
        this.errorMessage.innerHTML = "";
        this.removeError = null;
        if (window.isChuangGuan != 2) {
            this.style.border = "solid 1px #fff";
        }
        if (this.errorControl) {
            this.errorControl.style.background = "";
            this.errorControl = null;
        }
        fixBottom();
    }
}
function writeError(b, d, c) {
    b = $(b)[0];
    if (window.isChuangGuan != 2) {
        b.style.border = "dashed 1px #de6752";
    }
    if (b.errorMessage) {
        b.errorMessage.innerHTML = d;
    } else {
        var a = $(".errorMessage", $(b));
        b.errorMessage = a[0];
        if (!firstError && isValidating) {
            a.css("left", "50%");
            a.animate({left: 0}, 200);
        }
        b.errorMessage.innerHTML = d;
    }
    if ($(b.errorMessage).height() > 38) {
        b.errorMessage.style.lineHeight = "24px";
    } else {
        b.errorMessage.style.lineHeight = "38px";
    }
    b.removeError = removeError;
    if (b.errorControl) {
        b.errorControl.style.background = "#FBD5B5";
    }
    if (!firstError) {
        firstError = b;
    }
    fixBottom();
    return false;
}
function verifydata(d, c, e) {
    if (!c) {
        return "";
    }
    var a = null;
    if (c.toLowerCase() == "email" || c.toLowerCase() == "msn") {
        a = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;
        if (!a.exec(d)) {
            return validate_email;
        } else {
            return "";
        }
    } else {
        if (c == "日期" || c == "生日" || c == "入学时间") {
            return "";
        } else {
            if (c == "固话") {
                a = /^((\d{4}-\d{7})|(\d{3,4}-\d{8}))(-\d{1,4})?$/;
                if (!a.exec(d)) {
                    return validate_phone.replace("，请注意使用英文字符格式", "");
                } else {
                    return "";
                }
            } else {
                if (c == "手机") {
                    a = /^\d{11}$/;
                    if (!a.exec(d)) {
                        return validate_mobile.replace("，请注意使用英文字符格式", "");
                    } else {
                        return "";
                    }
                } else {
                    if (c == "密码") {
                        return checkPassword(d, e);
                    } else {
                        if (c == "确认密码") {
                            if (e && e.firstPwd) {
                                if (e.firstPwd.value != d) {
                                    return "两次密码输入不一致！";
                                }
                            }
                        } else {
                            if (c == "电话") {
                                a = /(^\d{11}$)|(^((\d{4}-\d{7})|(\d{3,4}-\d{8}))(-\d{1,4})?$)/;
                                if (!a.exec(d)) {
                                    return validate_mo_phone.replace("，请注意使用英文字符格式", "");
                                } else {
                                    return "";
                                }
                            } else {
                                if (c == "汉字") {
                                    a = /^[\u4e00-\u9fa5]+$/;
                                    if (!a.exec(d)) {
                                        return validate_chinese;
                                    } else {
                                        return "";
                                    }
                                } else {
                                    if (c == "姓名") {
                                        a = /^[\u4e00-\u9fa5]{2,10}$/;
                                        if (!a.exec(d)) {
                                            return "姓名必须为2到10个汉字";
                                        } else {
                                            return "";
                                        }
                                    } else {
                                        if (c == "英文") {
                                            a = /^[A-Za-z]+$/;
                                            if (!a.exec(d)) {
                                                return validate_english;
                                            } else {
                                                return "";
                                            }
                                        } else {
                                            if (c == "网址" || c == "公司网址") {
                                                a = /^https?:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/;
                                                var b = /^www.[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/;
                                                if (!a.exec(d) && !b.exec(d)) {
                                                    return validate_reticulation;
                                                } else {
                                                    return "";
                                                }
                                            } else {
                                                if (c == "身份证号") {
                                                    a = /^\d{15}(\d{2}[A-Za-z0-9])?$/;
                                                    if (!a.exec(d)) {
                                                        return validate_idcardNum;
                                                    } else {
                                                        return "";
                                                    }
                                                } else {
                                                    if (c == "学号") {
                                                        a = /^\d+$/;
                                                        if (!a.exec(d)) {
                                                            return validate_num.replace("，请注意使用英文字符格式", "");
                                                        }
                                                    } else {
                                                        if (c == "数字") {
                                                            a = /^(\-)?\d+$/;
                                                            if (!a.exec(d)) {
                                                                return validate_num.replace("，请注意使用英文字符格式", "");
                                                            }
                                                        } else {
                                                            if (c == "小数") {
                                                                a = /^(\-)?\d+(\.\d+)?$/;
                                                                if (!a.exec(d)) {
                                                                    return validate_decnum;
                                                                }
                                                            } else {
                                                                if (c.toLowerCase() == "qq") {
                                                                    a = /^\d+$/;
                                                                    var b = /^\w+([-+.]\w+)*@\w+([-.]\\w+)*\.\w+([-.]\w+)*$/;
                                                                    if (!a.exec(d) && !b.exec(d)) {
                                                                        return validate_qq;
                                                                    } else {
                                                                        return "";
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return "";
}
function checkPassword(f, d) {
    var c = /([a-zA-Z0-9!@#$%^&*()_?<>{}]){8,20}/;
    var b = /[a-zA-Z]+/;
    var a = /[0-9]+/;
    if (d && d.confirmPwd && d.needCheckConfirm) {
        var e = d.confirmPwd.value;
        if (e != f) {
            return "两次密码输入不一致！";
        }
    }
    if (c.test(f) && b.test(f) && a.test(f)) {
        return "";
    } else {
        if (!c.test(f)) {
            return "密码长度在8-20位";
        } else {
            if (!b.test(f)) {
                return "密码中必须包含字母";
            } else {
                if (!a.test(f)) {
                    return "密码中必须包含数字";
                }
            }
        }
    }
    return "";
}
function verifyMinMax(e, d, c, a) {
    if (d == "数字" || d == "小数") {
        var b = /^(\-)?\d+$/;
        if (d == "小数") {
            b = /^(\-)?\d+(\.\d+)?$/;
        }
        if (!b.exec(e)) {
            if (d == "小数") {
                return validate_decnum;
            } else {
                return validate_num.replace("，请注意使用英文字符格式", "");
            }
        }
        if (e != 0) {
            e = e.replace(/^0+/, "");
        }
        if (c != "") {
            if (d == "数字" && parseInt(e) - parseInt(c) < 0) {
                return validate_num2 + c;
            } else {
                if (d == "小数" && parseFloat(e) - parseFloat(c) < 0) {
                    return validate_num2 + c;
                }
            }
        }
        if (a != "") {
            if (d == "数字" && parseInt(e) - parseInt(a) > 0) {
                return validate_num1 + a;
            } else {
                if (d == "小数" && parseFloat(e) - parseFloat(a) > 0) {
                    return validate_num1 + a;
                }
            }
        }
    } else {
        if (a != "" && e.length - a > 0) {
            return validate_info_wd3.format(a, e.length);
        }
        if (c != "" && e.length - c < 0) {
            return validate_info_wd4.format(c, e.length);
        }
    }
    return "";
}
function getTopic(a) {
    return $(a).attr("topic");
}
function relationJoin(b) {
    if (b.style.display != "none") {
        var c = $(b);
        var a = c.attr("type");
        if (a == "3") {
            if ($("input:checked", c).length > 0) {
                displayRelationByType(c, "input[type=radio]", 1);
            }
        } else {
            if (a == "4") {
                if ($("input:checked", c).length > 0) {
                    displayRelationByType(c, "input[type=checkbox]", 2);
                }
            } else {
                if (a == "7") {
                    if ($("select", c)[0].selectedIndex > 0) {
                        displayRelationByType(c, "option", 5);
                    }
                }
            }
        }
    }
}
function displayRelationByType(e, d, c) {
    var b = getTopic(e);
    if (!relationQs[b]) {
        return;
    }
    e.hasDisplayByRelation = new Object();
    var a = -1;
    if (c == 4) {
        var f = $("a.rate-on", e);
        if (f[0] && $(f[0]).attr("mode")) {
            a = f.length - 1;
        }
    }
    $(d, e).each(function (h) {
        var j = false;
        var l = "";
        if (c == 1 || c == 2 || c == 5) {
            l = this.value;
        } else {
            if (c == 3) {
                l = $("input[type=hidden]", this).val();
            } else {
                if (c == 4) {
                    l = $(this).attr("val");
                }
            }
        }
        var m = b + "," + l;
        if (c == 3 && $(this).attr("check")) {
            j = true;
        } else {
            if (c == 4) {
                if (a == -1 && $(this).hasClass("rate-on")) {
                    j = true;
                } else {
                    if (h == a) {
                        j = true;
                    }
                }
            } else {
                if ((c == 1 || c == 2) && this.checked) {
                    j = true;
                } else {
                    if (c == 5 && this.selected) {
                        j = true;
                    }
                }
            }
        }
        displayByRelation(e, m, j);
        var g = b + ",-" + l;
        if (relationGroup.indexOf(b) != -1) {
            var k = relationGroupHT[g] || relationGroupHT[g.replace(",", ",-")];
            displayByRelation(e, g, j, true);
        }
        if (relationHT[g]) {
            displayByRelationNotSelect(e, g, j);
        }
    });
    fixBottom();
}
function checkDisplay(m) {
    var e = false;
    for (var a in m) {
        for (var d = 0; d < m[a].length; d++) {
            var g = m[a][d].replace("-", "");
            var j = m[a][d].replace("q", "").split("_");
            var i = document.getElementById(g);
            var l = document.getElementById("q" + j[0]);
            var h = document.getElementById("div" + j[0]);
            var f = $(h).attr("type");
            if (i && f != "11" && (j[1] > 0 == i.checked)) {
                e = true;
                break;
            } else {
                if (i && f == "11" && (j[1] > 0 == i.parentNode.getAttribute("check") == "1")) {
                    e = true;
                    break;
                } else {
                    if (!i && f == 5) {
                        var k = $("a.rate-on", h);
                        var b = "";
                        if (k.length > 0) {
                            b = $(k[k.length - 1]).attr("val");
                        }
                        if (j[1] == b) {
                            e = true;
                            break;
                        }
                    } else {
                        if (!i && l && j[1] == l.value) {
                            e = true;
                            break;
                        }
                    }
                }
            }
        }
    }
    return e;
}
function displayByRelation(q, H, w, E) {
    var x = getTopic(q);
    if (relationGroup.indexOf(x) != -1) {
        var o = "";
        var u = relationGroupHT[H] || relationGroupHT[H.replace(",", ",-")];
        if (u) {
            for (var y in u) {
                var m = new Object();
                var a = getTopic(u[y]);
                var n = u[y].getAttribute("relation");
                if (n) {
                    o = n.indexOf("|") != -1 ? "|" : "$";
                }
                for (var g in relationGroupHT) {
                    for (var p in relationGroupHT[g]) {
                        if (a == getTopic(relationGroupHT[g][p])) {
                            var A = g.split(",")[0];
                            if (!m[A]) {
                                m[A] = new Array();
                            }
                            m[A].push("q" + g.replace(",", "_"));
                        }
                    }
                }
                var C = false;
                if (o == "$") {
                    C = checkDisplay(m);
                } else {
                    C = true;
                    for (var d in m) {
                        var r = false;
                        for (var p = 0; p < m[d].length; p++) {
                            var D = m[d][p].replace("-", "");
                            var j = m[d][p].replace("q", "").split("_");
                            var l = document.getElementById(D);
                            var v = false;
                            var f = document.getElementById("div" + j[0]);
                            var t = $(f).attr("type");
                            if (j[1] < 0) {
                                if (t == "11") {
                                    v = $(f).find("li[check='1']").length > 0;
                                } else {
                                    v = $(f).find("input:checked").length > 0;
                                }
                            }
                            var b = document.getElementById("q" + j[0]);
                            if (l) {
                                if (t == "11" && j[1] > 0 == l.parentNode.getAttribute("check") == "1") {
                                    r = true;
                                } else {
                                    if (t != "11" && j[1] > 0 == l.checked) {
                                        r = true;
                                    }
                                }
                            }
                            if (r) {
                                if (j[1] < 0 && !v) {
                                    r = false;
                                } else {
                                    break;
                                }
                            } else {
                                if (!l && t == 5) {
                                    var B = $("a.rate-on", f);
                                    var G = "";
                                    if (B.length > 0) {
                                        G = $(B[B.length - 1]).attr("val");
                                    }
                                    if (j[1] == G) {
                                        r = true;
                                        break;
                                    }
                                } else {
                                    if (!l && b && j[1] == b.value) {
                                        r = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!r) {
                            C = false;
                            break;
                        }
                    }
                }
                var h = questionsObject[a];
                if (h) {
                    h[0].style.display = C ? "" : "none";
                    if (!C) {
                        loopHideRelation(h);
                    } else {
                        initqSlider(h[0]);
                        setTableWidth(h[0]);
                    }
                } else {
                    var F = document.getElementById("divCut" + (a.replace("c", "")));
                    if (F) {
                        F.style.display = C ? "" : "none";
                    }
                }
            }
        }
    }
    var s = relationHT[H];
    if (!s) {
        return;
    }
    for (var z = 0; z < s.length; z++) {
        var e = getTopic(s[z]);
        if (q.hasDisplayByRelation[e]) {
            continue;
        }
        if (!w && s[z].style.display != "none") {
            loopHideRelation(s[z]);
        } else {
            if (w) {
                s[z].style.display = "";
                if (s[z].getAttribute("isshop") == "1") {
                    updateCart(s[z]);
                }
                initqSlider(s[z]);
                setTableWidth(s[z]);
                if (!E) {
                    q.hasDisplayByRelation[e] = "1";
                }
                if (relationNotDisplayQ[e]) {
                    relationNotDisplayQ[e] = "";
                }
            }
        }
    }
}
function displayByRelationNotSelect(c, f, b) {
    var d = relationHT[f];
    if (!d) {
        return;
    }
    for (var a = 0; a < d.length; a++) {
        var e = getTopic(d[a]);
        if (c.hasDisplayByRelation[e]) {
            continue;
        }
        if (b && d[a].style.display != "none") {
            loopHideRelation(d[a]);
        } else {
            if (!b) {
                d[a].style.display = "";
                initqSlider(d[a]);
                setTableWidth(d[a]);
                c.hasDisplayByRelation[e] = "1";
                if (relationNotDisplayQ[e]) {
                    relationNotDisplayQ[e] = "";
                }
            }
        }
    }
}
function loopHideRelation(j) {
    var e = getTopic(j);
    var g = relationQs[e];
    if (g) {
        for (var a = 0; a < g.length; a++) {
            loopHideRelation(g[a], false);
        }
    }
    clearFieldValue(j);
    var f = $(j)[0];
    if (!f) {
        return;
    }
    var d = true;
    var c = $(j).attr("relation");
    if (c && c != "0" && c.indexOf("$") != -1) {
        var l = new Object();
        for (var b in relationGroupHT) {
            for (var h in relationGroupHT[b]) {
                if (e == getTopic(relationGroupHT[b][h])) {
                    var k = b.split(",")[0];
                    if (!l[k]) {
                        l[k] = new Array();
                    }
                    l[k].push("q" + b.replace(",", "_"));
                }
            }
        }
        var i = checkDisplay(l);
        if (i) {
            d = false;
        }
    }
    if (d) {
        f.style.display = "none";
        if (f.getAttribute("isshop") == "1") {
            updateCart(f);
        }
        if (relationNotDisplayQ[e] == "") {
            relationNotDisplayQ[e] = "1";
        }
    }
}
function checkHuChi(c, e) {
    var b = $(".huchi", c)[0];
    if (!b) {
        return;
    }
    var f = $(e);
    if (!$("input:checked", f)[0]) {
        return;
    }
    var a = $(".ui-checkbox", c);
    var d = f.hasClass("huchi");
    a.each(function () {
        if (this == e) {
            return true;
        }
        var g = $(this);
        if (!$("input:checked", g)[0]) {
            return true;
        }
        if (d) {
            g.trigger("click");
        } else {
            var h = g.hasClass("huchi");
            if (h) {
                g.trigger("click");
            }
        }
    });
}
function autoSubmit(c) {
    if (needTip()) {
        alert($(divTip).text());
        return;
    }
    if (window.hasSurveyTime) {
        while (cur_page < totalPage - 1) {
            pageHolder[cur_page].hasExceedTime = true;
            show_next_page();
        }
    }
    divMaxTime.style.display = "none";
    $("body").css("padding-top", "0px");
    pageHolder[cur_page].hasExceedTime = true;
    var b = $("#divNext a")[0];
    if (b) {
        b.disabled = false;
    }
    if (cur_page < totalPage - 1) {
        show_next_page();
    } else {
        pageHolder[cur_page].style.display = "none";
        if (b && b.initVal) {
            b.innerHTML = b.initVal;
        }
        if ((window.hasSurveyTime || window.isChuangGuan == 2) && (tCode.style.display == "none" && !window.useAliVerify) && window.hasAnswer && !c) {
            groupAnswer(1);
        } else {
            var a = "提示：您的作答时间已经超过最长时间限制，请直接提交答卷！";
            if (langVer == 1) {
                a = "Time is up,please submit!";
            }
            if (window.isChuangGuan == 2) {
                if (window.useAliVerify || tCode.style.display != "none") {
                    $("#divSubmit").show().css("padding-top", "30px").parent().css("background", "#fff").css("margin", "0 2px");
                    $("#divQuestion").css("border", "none").css("margin", "0 2px").css("border-radius", "0");
                }
                if (!hasChuGuanSuc) {
                    a = "提示：闯关失败！";
                } else {
                    a = "恭喜您闯关成功";
                }
            }
            if (c) {
                a = c;
            }
            $("#ValError").html(a);
        }
    }
}
$(function () {
    function g() {
        document.oncontextmenu = document.ondragstart = document.onselectstart = function () {
            return false;
        };
        var k = document.getElementsByTagName("input");
        var m = document.getElementsByTagName("textarea");
        for (var l = 0; l < k.length; l++) {
            k[l].onpaste = function () {
                return false;
            };
        }
        for (var l = 0; l < m.length; l++) {
            m[l].onpaste = function () {
                return false;
            };
        }
    }

    function e() {
        if (!window.localStorage) {
            return;
        }
        localStorage.setItem("wjxlastanswer" + activityId, new Date().getTime());
    }

    function d() {
        hasSurveyTime = true;
        hasMaxtime = true;
        var k = document.getElementById("yz_popdivData");
        if (k && k.style.display != "none") {
            $("#yz_popTanChuClose").click();
        }
        autoSubmit("由于您超过" + maxOpTime + "秒没有任何操作，系统为防止作弊不允许再作答！");
    }

    if (window.isKaoShi) {
        g();
        if (window.maxOpTime) {
            var c = false;
            if (window.localStorage) {
                var b = localStorage["wjxlastanswer" + activityId];
                if (b) {
                    var j = new Date().getTime();
                    var f = (j - b) / (60 * 1000);
                    if (f < 10) {
                        c = true;
                        d();
                        $("#divSubmit").hide();
                    }
                }
            }
            if (!c) {
                document.onclick = document.onkeyup = document.onmousemove = document.onscroll = function (k) {
                    h = new Date();
                };
                var a = null;
                var h = new Date();
                var i = setInterval(function () {
                    var m = new Date();
                    var k = parseInt((m - h) / 1000);
                    var l = maxOpTime + 5 - k;
                    var n = document.getElementById("divTimeUp");
                    if (l <= 0) {
                        clearInterval(i);
                        e();
                        d();
                    } else {
                        if (l <= 5 && n) {
                            if (n.style.display == "none") {
                                openDialogByIframe(300, 20, "divTimeUp");
                            }
                            document.getElementById("divTimeUpTip").innerHTML = "<span style='color:red;'>" + l + "</span>秒后无操作，将不允许再作答！";
                        }
                    }
                }, 1000);
            }
        }
    }
});
function CheckMax(e, c) {
    if (!c) {
        return true;
    }
    var f = $(e).attr("dval");
    var l = $(e).parent().parent().parent();
    if (l[0].tagName.toLocaleLowerCase() != "tbody") {
        return true;
    }
    var h = l.find("tr.trlabel").eq(0);
    var j = h.find("th");
    if (!j.eq(f - 1)) {
        return true;
    }
    var k = j.eq(f - 1).attr("itemmax");
    if (k && k > 0) {
        var g = l.find("a.rate-off");
        var b = 0;
        for (var d = 0; d < g.length; d++) {
            if (g.eq(d).hasClass("rate-on") && g.eq(d).attr("dval") == f) {
                b++;
            }
            if (b >= k) {
                break;
            }
        }
        if (b >= k) {
            var a = j.eq(f - 1).text();
            alert("提示：列选项“" + a + "”最多只允许选择" + k + "次");
            return false;
        }
    }
    return true;
}
function elagerImg(k, f) {
    k = k || window.event;
    if (k.stopPropagation) {
        k.stopPropagation();
    }
    var a = $(f).parent().attr("pimg");
    if (!a) {
        a = $(f).parent().find("img").attr("src");
    }
    var i = "#outdiv", c = "#indiv", g = "#bigimg", e = "#preView_wrap", h = i;
    var j = document.documentElement.clientWidth || document.body.clientWidth;
    var d = document.documentElement.clientHeight || document.body.clientHeight;
    var b = $(document).scrollTop();
    $(g).unbind("load");
    $(g).attr("src", a).load(function () {
        var n = this.width;
        var p = this.height;
        var o = n / p;
        var l;
        var m;
        if (p > d) {
            h = ".icon_close";
        } else {
            h = i;
        }
        $(e).addClass("flex");
        if (n > j) {
            l = "2%";
            p = j / o;
            n = j * 0.96;
            var m = (d - p) / 2;
            if (m < 0) {
                m = 10;
                $(e).removeClass("flex");
                p = d * 0.96;
            }
        } else {
            if (n < j * 0.8) {
                n = j * 0.8;
            }
            if (p < d * 0.4) {
                p = d * 0.4;
            }
            var l = (j - n) / 2;
            var m = (d - p) / 2;
            if (m < 0) {
                p = d * 0.96;
                m = "2%";
                $(e).removeClass("flex");
            }
        }
        $(c).css({left: l, top: m});
        $(e).css({width: n, height: p});
        $(i).fadeIn("fast");
        $("body").addClass("noscorrl");
        $(h).click(function (q) {
            $(i).fadeOut("fast");
            $("body").removeClass("noscorrl");
            $(document).scrollTop(b);
            $(g).attr("src", "");
            $(h).unbind("click");
        });
    });
}
function openDialogByIframe(b, k, a, j) {
    var g = $(window).width(), f = $(document).height();
    if (a == "divImgPop" || a.indexOf("divVCode") > -1 || a == "divTimeUp") {
        k = k + 30;
    } else {
        b = Math.min(g, 400) - 30;
        if (a.indexOf("divDesc_") == 0) {
            k = k + 30;
        } else {
            if (a.indexOf("setcity") == -1) {
                k = Math.min($(window).height(), 400) - 20;
            }
        }
        if (a.indexOf("amap.aspx") > -1 || a.indexOf("school.aspx") > -1 || j) {
            k = $(window).height() - 30;
            b = $(window).width() - 20;
        }
    }
    $("body").append("<div id='yz_popIframeDiv'></div>");
    var d = document.getElementById(a);
    var c = "<div id='yz_popTanChu' style='border-radius: 8px;'><div style='position:relative;'><a id='yz_popTanChuClose' style='background:url(/images/bt_closed.gif) no-repeat;width:30px;height:30px;margin:-15px -18px 0 0;display:inline;float:right;cursor:pointer;position:absolute;right:0;'></a></div>";
    if (!d) {
        c += "<iframe id='yz_popwinIframe' frameborder='0' hspace='0' src=" + a + " style='border-radius:8px;'></iframe>";
    } else {
        c += "<div id='yz_popdivData' style='padding:10px;height:" + (k - 30) + "px;overflow:auto;width:" + b + "px;'></div>";
    }
    c += "</div>";
    $("body").append(c);
    $("#yz_popIframeDiv").css({
        width: g,
        height: f,
        background: "#000",
        position: "absolute",
        zIndex: "100",
        left: "0",
        top: "0"
    });
    $("#yz_popIframeDiv").fadeTo(0, 0.5);
    var e = $(window).width() / 2 - b / 2;
    var h = $(window).height() / 2 - k / 2 + $(window).scrollTop();
    $("#yz_popTanChu").css({
        width: b,
        height: k,
        left: e,
        top: h,
        background: "#fff",
        position: "absolute",
        zIndex: 200
    });
    if (d) {
        $("#yz_popdivData").html(d.innerHTML);
    }
    var i = k;
    $("#yz_popwinIframe").css({width: b, height: i, "border-bottom": "1px #ccc solid", background: "#ffffff"});
    $("#yz_popTanChuClose,#yz_popIframeDiv").click(function () {
        $("#yz_popIframeDiv").remove();
        $("#yz_popTanChu").remove();
    });
}